KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > dom > xpath > XPathExpression


1 /*
2  * Copyright (c) 2002 World Wide Web Consortium,
3  * (Massachusetts Institute of Technology, Institut National de
4  * Recherche en Informatique et en Automatique, Keio University). All
5  * Rights Reserved. This program is distributed under the W3C's Software
6  * Intellectual Property License. This program is distributed in the
7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  * PURPOSE.
10  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
11  */

12
13 package org.w3c.dom.xpath;
14
15
16 import org.w3c.dom.Node JavaDoc;
17 import org.w3c.dom.DOMException JavaDoc;
18
19 /**
20  * The <code>XPathExpression</code> interface represents a parsed and resolved
21  * XPath expression.
22  * <p>See also the <a HREF='http://www.w3.org/2002/08/WD-DOM-Level-3-XPath-20020820'>Document Object Model (DOM) Level 3 XPath Specification</a>.
23  */

24 public interface XPathExpression {
25     /**
26      * Evaluates this XPath expression and returns a result.
27      * @param contextNode The <code>context</code> is context node for the
28      * evaluation of this XPath expression.If the XPathEvaluator was
29      * obtained by casting the <code>Document</code> then this must be
30      * owned by the same document and must be a <code>Document</code>,
31      * <code>Element</code>, <code>Attribute</code>, <code>Text</code>,
32      * <code>CDATASection</code>, <code>Comment</code>,
33      * <code>ProcessingInstruction</code>, or <code>XPathNamespace</code>
34      * node.If the context node is a <code>Text</code> or a
35      * <code>CDATASection</code>, then the context is interpreted as the
36      * whole logical text node as seen by XPath, unless the node is empty
37      * in which case it may not serve as the XPath context.
38      * @param type If a specific <code>type</code> is specified, then the
39      * result will be coerced to return the specified type relying on
40      * XPath conversions and fail if the desired coercion is not possible.
41      * This must be one of the type codes of <code>XPathResult</code>.
42      * @param result The <code>result</code> specifies a specific result
43      * object which may be reused and returned by this method. If this is
44      * specified as <code>null</code>or the implementation does not reuse
45      * the specified result, a new result object will be constructed and
46      * returned.For XPath 1.0 results, this object will be of type
47      * <code>XPathResult</code>.
48      * @return The result of the evaluation of the XPath expression.For XPath
49      * 1.0 results, this object will be of type <code>XPathResult</code>.
50      * @exception XPathException
51      * TYPE_ERR: Raised if the result cannot be converted to return the
52      * specified type.
53      * @exception DOMException
54      * WRONG_DOCUMENT_ERR: The Node is from a document that is not supported
55      * by the XPathEvaluator that created this <code>XPathExpression</code>
56      * .
57      * <br>NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
58      * context node or the request type is not permitted by this
59      * <code>XPathExpression</code>.
60      */

61     public Object JavaDoc evaluate(Node JavaDoc contextNode,
62                            short type,
63                            Object JavaDoc result)
64                            throws XPathException, DOMException JavaDoc;
65
66 }
67
Popular Tags