name_value/to_xml: minor refactoring