'Exports a single record to the element tree.
@param record: the record
@param rfields: list of foreign key fields to export
@param dfields: list of data fields to export
@param parent: the parent element
@param export_map: the export map of the current request
@param url: URL of the record
@param master: True if this is a record in the master resource
@param location_data: the location_data for GIS encoding'

def _export_record(self, record, rfields=[], dfields=[], parent=None, export_map=None, lazy=None, url=None, master=True, location_data=None):

    xml = current.xml
    tablename = self.tablename
    table = self.table
    auth_user_represent = Storage()
    if hasattr(current, 'auth_user_represent'):
        user_ids = ('created_by', 'modified_by', 'owned_by_user')
        for fn in user_ids:
            if hasattr(table, fn):
                f = ogetattr(table, fn)
                auth_user_represent[fn] = f.represent
                f.represent = current.auth_user_represent
    if (export_map and (tablename in export_map) and (record[table._id] in export_map[tablename])):
        return (None, None)
    current.audit('read', self.prefix, self.name, record=record[table._id], representation='xml')
    rmap = xml.rmap(table, record, rfields)
    linked = self.linked
    if ((self.parent is not None) and (linked is not None)):
        alias = linked.alias
        name = linked.name
    else:
        alias = self.alias
        name = self.name
    if (alias == name):
        alias = None
    postprocess = self.get_config('xml_post_render')
    element = xml.resource(parent, table, record, fields=dfields, alias=alias, lazy=lazy, url=url, postprocess=postprocess)
    xml.add_references(element, rmap, show_ids=xml.show_ids, lazy=lazy)
    if master:
        xml.gis_encode(self, record, element, location_data=location_data)
    for fn in auth_user_represent:
        ogetattr(table, fn).represent = auth_user_represent[fn]
    return (element, rmap)
