Document Class

Use the Document class to process XML content. You can parse nested XML content that’s up to 50 nodes deep.

Dom

One common application is to use it to create the body of a request for HttpRequest or to parse a response accessed by HttpResponse.

See Also

The following are constructors for Document.

  • Document()

    Creates a new instance of the Dom.Document class.

Creates a new instance of the Dom.Document class.

public Document()

The following are methods for Document. All are instance methods.

  • createRootElement(name, namespace, prefix)

    Creates the top-level root element for a document.

  • getRootElement()

    Returns the top-level root element node in the document. If this method returns null, the root element has not been created yet.

  • load(xml)

    Parse the XML representation of the document specified in the xml argument and load it into a document.

  • toXmlString()

    Returns the XML representation of the document as a String.

Creates the top-level root element for a document.

public Dom.XmlNode createRootElement(String name, String namespace, String prefix)

Type: Dom.XmlNode

For more information about namespaces, see Reading and Writing XML Using the DOM.

Calling this method more than once on a document generates an error as a document can have only one root element.

Returns the top-level root element node in the document. If this method returns null, the root element has not been created yet.

public Dom.XmlNode getRootElement()

Type: Dom.XmlNode

Parse the XML representation of the document specified in the xml argument and load it into a document.

public Void load(String xml)

Type: Void

Returns the XML representation of the document as a String.

public String toXmlString()

Type: String