Adding test coverage for to_xml