Updated to use custom_header in to_xml_file