elemental.xpath.XPathEvaluator Maven / Gradle / Ivy
Show all versions of xapi-gwt Show documentation
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package elemental.xpath;
import elemental.dom.Node;
import elemental.events.*;
import elemental.util.*;
import elemental.dom.*;
import elemental.html.*;
import elemental.css.*;
import elemental.stylesheets.*;
import java.util.Date;
/**
* This interface is used to evaluate XPath expressions against a DOM node.Inherits from: 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);
*/
public interface XPathEvaluator {
/**
* Creates an nsIDOMXPathExpression
which can then be used for (repeated) evaluations.
Gecko 1.9 note(Firefox 3)
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.
Parameters
expression
- A string representing the XPath to be created.
resolver
- A name space resolver created by , or a user defined name space resolver. Read more on Implementing a User Defined Namespace Resolver if you wish to take the latter approach.
Return value
An XPath expression, as an nsIDOMXPathExpression
object.
*/
XPathExpression createExpression(String expression, XPathNSResolver resolver);
/**
* 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.
Parameters
nodeResolver
- The node to be used as a context for name space resolution.
Return value
A name space resolver.
*/
XPathNSResolver createNSResolver(Node nodeResolver);
/**
* Evaluate the specified XPath expression.
Parameters
expression
- A string representing the XPath to be evaluated.
contextNode
- A DOM Node to evaluate the XPath expression against. To evaluate against a whole document, use the
document.documentElement
. resolver
- A name space resolver created by , 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
- A number that corresponds to one of the type constants of
nsIXPathResult
. result
- An existing
nsIXPathResult
to use for the result. Using null
will create a new nsIXPathResult
.
Return value
An XPath result.
*/
XPathResult evaluate(String expression, Node contextNode, XPathNSResolver resolver, int type, XPathResult inResult);
}