Scoped XMLDocument2 - getFirstNode(String xPath)

Gets the first node in the specified XPATH.

Table 1. Parameters
Name Type Description
xPath String The XPATH.
Table 2. Returns
Type Description
XMLNode The first node.
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);
var foo = xmlDoc.getFirstNode('/test/one/two');
gs.info(foo.getTextContent());
Output:
abcd1234