public selectSingleNode(expression as String, contextNode as Node, resolver as XPathNSResolver = null) as Node throws XPathException, DOMException:
Evaluates an XPath expression and returns its first matching node.
This is a Klyn convenience method for the common single-node lookup case. It returns null when no node matches.
| Parameter | Description |
|---|---|
expression | XPath expression selecting nodes. |
contextNode | Context node. |
resolver | Namespace resolver, or null. |
First matching node, or null.
node = DOMXPathEvaluator().selectSingleNode("/Spies/Spy[@id='007']", document)
if node is not null:
print(node.nodeName)