Newer Version Available
Document Class
Use the Document class
to process XML content. You can parse nested XML content that’s up to 50 nodes deep.
Namespace
Usage
One common application is to use it to create the body of a request for HttpRequest or to parse a response accessed by HttpResponse.
Document Methods
The following are methods for Document. All are instance methods.
createRootElement(name, namespace, prefix)
Creates the top-level root element for a document.
Signature
public Dom.XmlNode createRootElement(String name, String namespace, String prefix)
Return Value
Type: Dom.XmlNode
Usage
For more information about namespaces, see XML Namespaces.
Calling this method more than once on a document generates an error as a document can have only one root element.
getRootElement()
Returns the top-level root element node in the document.
If this method returns null, the root element has not been created yet.
Signature
public Dom.XmlNode getRootElement()
Return Value
Type: Dom.XmlNode
load(xml)
Parse the XML representation of the document specified
in the xml argument and load it into a document.
Signature
public Void load(String xml)
Parameters
- xml
- Type: String
Return Value
Type: Void
Example
toXmlString()
Returns the XML representation of the document as a String.
Signature
public String toXmlString()
Return Value
Type: String