xml_local/user_xml should be freed/set at the end