Generate Formatted XML

PeopleCode includes a class library for working with XML documents called XMLDoc.

There are a number of very useful methods within in this class including, GenFormattedXmlString which takes XML (as a string) and formats it with new line characters and indents so its more readable.

To use this method, simply declare an XmlDoc object, pass it the unformatted XML and call the GenFormattedXmlString method like so:

Local XmlDoc &oXD;
Local string &sUnformattedXML, &sFormattedXML;

&sUnformattedXML = "[Your unformatted XML goes here]";
&oXD = CreateXmlDoc(&sUnformattedXML);
&sFormattedXML = &oXD.GenFormattedXmlString();
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License