Scoped XMLDocument2 - getDocumentElement()

Gets the document element node of the XMLdocument2 object. The document element node is the root node.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
XMLNode The document element.
var xmlString = "<test>" +
                "  <one>" +
                "    <two att=\"xxx\">abcd1234</two>" +
                "    <three boo=\"yah\" att=\"yyy\">1234abcd</three>" +
                "    <two>another</two>" +
                "  </one>" +
                "  <number>1234</number>" +
                "</test>";
var xmlDoc = new XMLDocument2();
xmlDoc.parseXML(xmlString);
//returns the root node of the document tree.
var rootNode = xmlDoc.getDocumentElement();
gs.info(rootNode.getTextContent());
Output:
abcd1234    1234abcd    another    1234