Link Search Menu Expand Document

XmlNode.SelectSingleNode Method

Explanation Searches for nodes that match the conditions specified in XPath .
Call format var node2 = node.SelectSingleNode( xpath )
Return value The first XmlNode object found among the nodes that match the search criteria
Returns null if no matching node is found .
Arguments String xpath Specify the search conditions in XPath format.
The XPath format conforms to the SelectNodes method.
Exception None
Example of use
    var domimpl = new XmlDOMImplementation;
    var res = session.Get("/test/sample.xml");
    var xmldoc = domimpl.Load(res);
    var node = xmldoc.DocumentElement.SelectSingleNode("//CODE");
    if (node != null) {
        print(node.NodeName, "\n");
    }
    
Related item SelectNodes method