There are this and many other XML-handling libraries ... XML::LibXML, XML::Twig .. many more ... but the basic notion is the same: use an XML library to handle XML. Build a data-structure in memory, using hashrefs and so-forth, then use the library to create a proper XML structure which contains it. (Treat that string as a “black box.”) Validate this XML against the target system ... or, if they supply a schema, use an XML-validation tool to validate your output against that schema.
What you generally do not want to do is to try to “brute-force generate” an XML-looking output yourself. This certainly can be done, e.g. using Template::Toolkit, but it’s a lot more work to yield a more-uncertain output string.
| |