Interface XPathEvaluator


interface XPathEvaluator
An interface with the XPath functionality.

Document.prototype and/or document will be extended using install to implements it’s functions.

See http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator.

Authors:
Henrik Lindqvist <henrik.lindqvist@llamalab.com>
Defined in XPath.js

Function Summary
Creates a pre-parsed expression.
Create a namespace resolver by scanning a node for xmlns: attributes.
XPathResult evaluate(string e, Node n, XPathNSResolver nsr, number rt, XPathResult r)
Evaluate an expression.
static install(object o, [boolean f])
Non-standard function that extends the provided object with XPathEvaluator functions.

Function Details

function createExpression

XPathExpression createExpression(string e, XPathNSResolver nsr)
Creates a pre-parsed expression.
Parameters:
e - expression.
nsr - namespace resolver to use when evaluating, or null.
Returns:

function createNSResolver

XPathNSResolver createNSResolver(Node n)
Create a namespace resolver by scanning a node for xmlns: attributes.
Parameters:
n - an Node with defined namespace attributes (i.e the documentElement).
Returns:

function evaluate

XPathResult evaluate(string e, Node n, XPathNSResolver nsr, number rt, XPathResult r)
Evaluate an expression.

Same as new XPathExpression(e, nsr).evaluate(n, rt).

Parameters:
e - XPath expression string.
n - context node.
nsr - namespace resolver to use when evaluating, or null.
rt - return type, see XPathResult.
r - XPathResult that maybe reuse, or null. Ignored.
Returns:

function install

static install(object o, [boolean f])
Non-standard function that extends the provided object with XPathEvaluator functions.
Parameters:
o - object (i.e document node) to extend.
[f] - force replace the build-in function even if they exists.