klyn.io.xml.xpath.DOMXPathEvaluator.selectNodes
method
public selectNodes(expression as String, contextNode as Node, resolver as XPathNSResolver = null) as NodeList throws XPathException, DOMException:
Description

Evaluates an XPath expression and returns the matching nodes as a DOM NodeList.

This is a Klyn convenience method. The standard DOM XPath API still uses evaluate(...) and XPathResult.

Parameters
ParameterDescription
expressionXPath expression selecting nodes.
contextNodeContext node.
resolverNamespace resolver, or null.
Returns

Matching nodes in document order.

Throws
  • XPathException if the expression cannot be converted to a node set.
  • DOMException if the context node is invalid.
Example
nodes = DOMXPathEvaluator().selectNodes("/Spies/Spy", document)
print(nodes.length)