in reply to Recomendations for a XML writer module
If you have an XSD for your XML then XML::Compile can take care for creating well-formed XML from your Perl data structures.