AwaitedDOM/ XPathExpression

This interface is a compiled XPath expression that can be evaluated on a document or specific node to return information from its DOM tree. This is useful when an expression will be reused in an application, because it is just compiled once and all namespace prefixes which occur within the expression are preresolved.
Objects of this type are created by calling XPathEvaluator.createExpression().


.evaluate(contextNode, type?, result?)

Evaluates the XPath expression on the given node or document.


  • contextNode Node. A Node representing the context to use for evaluating the expression.
  • type number. Specifies the type of result to be returned by evaluating the expression. This must be one of the XPathResult.Constants.
  • result XPathResult. Allows to specify a result object which may be reused and returned by this method. If this is specified as null or the implementation does not reuse the specified result, a new result object will be returned.

Returns: XPathResult

Edit this page on GitHub