build and test to_xml