XPathEvaluator
interface in package org.w3c.dom.xpath

    public interface XPathEvaluator:

XPathEvaluator

Evaluates XPath 1.0 expressions against DOM nodes.

Example

    import klyn.io.xml.dom
    import klyn.io.xml.xpath
    import org.w3c.dom.xpath

    document = XMLDocument()
    evaluator as XPathEvaluator = DOMXPathEvaluator()
    result = evaluator.evaluate("count(//item)", document, null, XPathResult.NUMBER_TYPE, null)
    print(result.numberValue)

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | createExpression `createExpression(expression as String, resolver as XPathNSResolver) as XPathExpression throws XPathException, DOMException` | Creates a reusable compiled XPath expression.
public | createNSResolver `createNSResolver(nodeResolver as Node) as XPathNSResolver` | Creates a namespace resolver from a DOM node.
public | evaluate `evaluate(expression as String, contextNode as Node, resolver as XPathNSResolver, type as Int, result as XPathResult) as XPathResult throws XPathException, DOMException` | Evaluates an XPath expression immediately.