in reply to How to create XML tree from non-XML source
There are many Perl modules available for generating/creating XML: Any::Renderer::XML (generates "element only" XML), XML::Generator or XML::Writer to name a few. It depends a bit on what you really need in terms of XML features and how far you wanna push it.
For xpath you can use XML::XPath.
I am using XML::Twig a lot lately. It is turning into a one-solution-for-all-xml-problems for me:-)
Hope this helps