Icon SerializeXML

Unit: WebCore

Available In: Client Applications

function SerializeXML(Document: TDocument): String

The SerializeXML function converts the XML nodes present in the TDocument instance parameter into a string. The return value is a String value.

Information Please refer to the WebDOM unit source code for the declaration of the TNode, TDocument, and TNodeList classes and their various properties.

Examples

var
   TempXML: String;
   TempDocument: TDocument;
   TempNodes: TNodeList;
begin
   TempXML := '<a><b><c><username>testuser</username></c></b></a>';
   TempDocument := ParseXML(TempXML);
   TempNodes := TempDocument.getElementsByTagName('username');
   ShowMessage(IntToStr(TempNodes.length)); // Number of nodes
   ShowMessage(TempNodes[0].firstChild.nodeValue); // Get text node
   TempXML := SerializeXML(TempDocument);
   ShowMessage(TempXML);
end
Image