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);
nsIDOMXPathExpression createExpression(in DOMString expression, in nsIDOMXPathNSResolver resolver) |
nsIDOMXPathNSResolver createNSResolver(in nsIDOMNode nodeResolver); |
nsISupports evaluate(in DOMString expression, in nsIDOMNode contextNode, in nsIDOMXPathNSResolver resolver, in unsigned short type, in nsISupports result) |
Creates an nsIDOMXPathExpression
which can then be used for (repeated) evaluations.
Note: 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.
nsIDOMXPathExpression createExpression( in DOMString expression, in nsIDOMXPathNSResolver resolver );
expression
resolver
createNSResolver()
, or a user defined name space resolver. Read more on Implementing a User Defined Namespace Resolver if you wish to take the latter approach.An XPath expression, as an nsIDOMXPathExpression
object.
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.
nsIDOMXPathNSResolver createNSResolver( in nsIDOMNode nodeResolver );
nodeResolver
A name space resolver.
Evaluate the specified XPath expression.
nsISupports evaluate( in DOMString expression, in nsIDOMNode contextNode, in nsIDOMXPathNSResolver resolver, in unsigned short type, in nsISupports result );
expression
contextNode
document.documentElement
.resolver
createNSResolver()
, or a user defined name space resolver. Read more on Implementing a User Defined Namespace Resolver if you wish to take the latter approach.type
nsIXPathResult
.result
nsIXPathResult
to use for the result. Using null
will create a new nsIXPathResult
.An XPath result.