org.w3c.dom.xpath.XPathEvaluator.evaluate
method

    public evaluate(expression as String, contextNode as Node, resolver as XPathNSResolver, type as Int, result as XPathResult) as XPathResult throws XPathException, DOMException

Description

Evaluates an XPath expression immediately.

Parameters

- expression XPath expression text.
- contextNode Context node.
- resolver Namespace resolver, or `null` when no prefixes are used.
- type Requested `XPathResult` type.
- result Reusable result object, or `null`.

Returns

XPath result.

Throws

- XPathException if expression evaluation or result conversion fails.
- DOMException if the context node is invalid.

Example

    result = evaluator.evaluate("string(//item/@id)", document, null, XPathResult.STRING_TYPE, null)
    print(result.stringValue)