An XML file can be ready by using:
XmlDocument.ReadFrom(XMLStr, XmlDocument); //Here XMLStr is the Text variable that containt your XML
To select nodes, declare a variable of type XmlNodeList and use:
IF XmlDocument.SelectNodes('//node1/child1',XmlNodeList)
To write an XML to a string, just use XMLDocument.WriteTo(DocumentText); //DocumentText is a Text variable
An example on an XML "on the fly" creation with output to the end user:
xmlDoc := xmlDocument.Create();
xmlDec := xmlDeclaration.Create('1.0', 'UTF-8', '');
xmlDoc.SetDeclaration(xmlDec);
xmlElem := xmlElement.Create('root');
xmlElem.SetAttribute('release', '2.1');
xmlElem2 := XmlElement.Create('FirstName');
xmlElem2.Add(xmlText.Create('Max'));
xmlElem.Add(xmlElem2);
xmlDoc.Add(xmlElem);
// Create an out stream from the blob, notice the encoding.
TempBlob.Blob.CreateOutStream(outStr, TextEncoding::UTF8);
// Write the contents of the doc to the stream
xmlDoc.WriteTo(outStr);
// From the same blob, that now contains the xml document, create an instr
TempBlob.Blob.CreateInStream(inStr, TextEncoding::UTF8);
// Save the data of the InStream as a file.
File.DownloadFromStream(inStr, 'Export', '', '', fileName);