Split record_to_xml to create a intermediate function called record_to_xmlNode allowing generate a ElementTree document for easy manipulation, avoiding parsing back from string to xml.