KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > xml > xpath > XPathProcessor


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.excalibur.xml.xpath;
18
19 import org.w3c.dom.Node JavaDoc;
20 import org.w3c.dom.NodeList JavaDoc;
21
22 /**
23  * This is the interface of the XPath processor.
24  *
25  * <p>All methods have two variants: one which takes a PrefixResolver as an extra
26  * argument, and one which doesn't. The {@link PrefixResolver} interface allows to provide
27  * your own namespace prefix resolving.
28  *
29  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
30  * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:15 $ $Author: cziegeler $
31  */

32 public interface XPathProcessor
33 {
34     /**
35      * The role implemented by an <code>XSLTProcessor</code>.
36      */

37     String JavaDoc ROLE = XPathProcessor.class.getName();
38
39     /**
40      * Evaluate XPath expression within a context.
41      *
42      * @param contextNode The context node.
43      * @param str A valid XPath string.
44      * @return expression result as boolean.
45      */

46     boolean evaluateAsBoolean( Node JavaDoc contextNode, String JavaDoc str );
47
48     /**
49      * Evaluate XPath expression within a context.
50      *
51      * @param contextNode The context node.
52      * @param str A valid XPath string.
53      * @return expression result as number.
54      */

55     Number JavaDoc evaluateAsNumber( Node JavaDoc contextNode, String JavaDoc str );
56
57     /**
58      * Evaluate XPath expression within a context.
59      *
60      * @param contextNode The context node.
61      * @param str A valid XPath string.
62      * @return expression result as string.
63      */

64     String JavaDoc evaluateAsString( Node JavaDoc contextNode, String JavaDoc str );
65
66     /**
67      * Use an XPath string to select a single node.
68      *
69      * @param contextNode The node to start searching from.
70      * @param str A valid XPath string.
71      * @return The first node found that matches the XPath, or null.
72      */

73     Node JavaDoc selectSingleNode( Node JavaDoc contextNode, String JavaDoc str );
74
75     /**
76      * Use an XPath string to select a nodelist.
77      *
78      * @param contextNode The node to start searching from.
79      * @param str A valid XPath string.
80      * @return A List, should never be null.
81      */

82     NodeList JavaDoc selectNodeList( Node JavaDoc contextNode, String JavaDoc str );
83
84     /**
85      * Evaluate XPath expression within a context.
86      *
87      * @param contextNode The context node.
88      * @param str A valid XPath string.
89      * @param resolver a PrefixResolver, used for resolving namespace prefixes
90      * @return expression result as boolean.
91      */

92     boolean evaluateAsBoolean( Node JavaDoc contextNode, String JavaDoc str, PrefixResolver resolver );
93
94     /**
95      * Evaluate XPath expression within a context.
96      *
97      * @param contextNode The context node.
98      * @param str A valid XPath string.
99      * @param resolver a PrefixResolver, used for resolving namespace prefixes
100      * @return expression result as number.
101      */

102     Number JavaDoc evaluateAsNumber( Node JavaDoc contextNode, String JavaDoc str, PrefixResolver resolver );
103
104     /**
105      * Evaluate XPath expression within a context.
106      *
107      * @param contextNode The context node.
108      * @param str A valid XPath string.
109      * @param resolver a PrefixResolver, used for resolving namespace prefixes
110      * @return expression result as string.
111      */

112     String JavaDoc evaluateAsString( Node JavaDoc contextNode, String JavaDoc str, PrefixResolver resolver );
113
114     /**
115      * Use an XPath string to select a single node.
116      *
117      * @param contextNode The node to start searching from.
118      * @param str A valid XPath string.
119      * @param resolver a PrefixResolver, used for resolving namespace prefixes
120      * @return The first node found that matches the XPath, or null.
121      */

122     Node JavaDoc selectSingleNode( Node JavaDoc contextNode, String JavaDoc str, PrefixResolver resolver );
123
124     /**
125      * Use an XPath string to select a nodelist.
126      *
127      * @param contextNode The node to start searching from.
128      * @param str A valid XPath string.
129      * @param resolver a PrefixResolver, used for resolving namespace prefixes
130      * @return A List, should never be null.
131      */

132     NodeList JavaDoc selectNodeList( Node JavaDoc contextNode, String JavaDoc str, PrefixResolver resolver );
133 }
134
Popular Tags