public interface XPathEvaluator
nsISupports
Last changed in Gecko 1.7
Implemented by: @mozilla.org/dom/xpath-evaluator;1
. To create an instance, use:
var domXPathEvaluator = Components.classes["@mozilla.org/dom/xpath-evaluator;1"] .createInstance(Components.interfaces.nsIDOMXPathEvaluator);
Modifier and Type | Method and Description |
---|---|
XPathExpression |
createExpression(String expression,
XPathNSResolver resolver)
Creates an
nsIDOMXPathExpression
which can then be used for (repeated) evaluations. |
XPathNSResolver |
createNSResolver(Node nodeResolver)
Creates an
nsIDOMXPathExpression
which resolves name spaces with respect to the definitions in scope for a specified node. |
XPathResult |
evaluate(String expression,
Node contextNode,
XPathNSResolver resolver,
int type,
XPathResult inResult)
Evaluate the specified XPath expression.
|
XPathExpression createExpression(String expression, XPathNSResolver resolver)
Creates an nsIDOMXPathExpression
which can then be used for (repeated) evaluations.
Prior to Gecko 1.9, you could call this method on documents other than the one you planned to run the XPath against; starting with Gecko 1.9, however, you must call it on the same document.
expression
resolver
An XPath expression, as an nsIDOMXPathExpression
object.
XPathNSResolver createNSResolver(Node nodeResolver)
Creates an nsIDOMXPathExpression
which resolves name spaces with respect to the definitions in scope for a specified node. It is used to resolve prefixes within the XPath itself, so that they can be matched with the document. null
is common for HTML documents or when no name space prefixes are used.
nodeResolver
A name space resolver.
XPathResult evaluate(String expression, Node contextNode, XPathNSResolver resolver, int type, XPathResult inResult)
Evaluate the specified XPath expression.
expression
contextNode
document.documentElement
.resolver
type
nsIXPathResult
.result
nsIXPathResult
to use for the result. Using null
will create a new nsIXPathResult
.An XPath result.
Copyright © 2016. All rights reserved.