Name
Document.evaluate( ): evaluate an XPath expression — Firefox 1.0, Safari 2.01, Opera 9:
Synopsis
XPathResult evaluate(StringxpathText, NodecontextNode, FunctionnamespaceURLMapper, shortresultType, XPathResultresult) throws DOMException, XPathException
Arguments
-
xpathText The string representing the XPath expression to evaluate.
-
contextNode The node in this document against which the expression is to be evaluated.
-
namespaceURLMapper A function that will map from a namespace prefix to a full namespace URL or
nullif no such mapping is required.-
resultType Specifies the type of object expected as a result, using XPath conversions to coerce the result. Possible values for
typeare the constants defined by the XPathResult object.-
result An XPathResult object to be reused or
nullif you want a new XPathResult object to be created.
Returns
A XPathResult object representing the evaluation of the expression against the given context node.
Throws
This method may throw an exception if the
xpathText contains a syntax error, if
the result of the expression cannot be converted to the desired
resultType, if the expression contains
namespaces that namespaceURLMapper
cannot resolve, or if contextNode is of
the wrong type or is not associated with this document.
Description
This method evaluates the specified XPath expression
against the given context node and returns an XPathResult object,
using type to determine what the result type should be. If you want to evaluate an expression more than once, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access