JavaScript method: XML.toXMLString()

This method converts an XML object into a valid XML string. You must use the other XML get methods to navigate through an XML document.

Syntax

XML.toXMLString();

Arguments

There are no arguments for this method.

Return values

A string or null.

The method returns a string containing valid XML or returns null if the current node is not an XML object.

Example

This example converts an XML object into a valid XML document.

This example requires the following sample data:

  • An existing XML object (for example, the list of currently logged on users stored in system.users)
var xmlObject = system.users
print( "This is the original XML object:\n" + xmlObject );
var xmlString = xmlObject.toXMLString();
print( "This is the XML object after conversion to a string:\n" + xmlString );