Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Document Class
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)
Signature
public Dom.XmlNode createRootElement(String name, String namespace, String prefix)
Return Value
Type: Dom.XmlNode
Usage
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.
getRootElement()
Signature
public Dom.XmlNode getRootElement()
Return Value
Type: Dom.XmlNode
load(xml)
Signature
public Void load(String xml)
Parameters
- xml: Type: String
Return Value
Type: Void
Example
1Dom.Document doc = new Dom.Document();
2doc.load(xml);toXmlString()
Signature
public String toXmlString()
Return Value
Type: String