Refactoring method create_xml_file