1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 package org.jaxen.saxpath;
66
67
68 /*** Interface for event-based XPath parsing.
69 *
70 * <p>
71 * A {@link org.jaxen.saxpath.XPathReader} generates callbacks into
72 * an <code>XPathHandler</code> to allow for custom
73 * handling of the parse.
74 * </p>
75 *
76 * <p>
77 * The callbacks very closely match the productions
78 * listed in the W3C XPath specification. Gratuitous
79 * productions (ie, Expr/startExpr()/endExpr())are not
80 * included in this API.
81 * </p>
82 *
83 * @author bob mcwhirter (bob@werken.com)
84 */
85 public interface XPathHandler
86 {
87 /*** Receive notification of the start of an XPath expression parse.
88 */
89 void startXPath() throws org.jaxen.saxpath.SAXPathException;
90
91 /*** Receive notification of the end of an XPath expression parse.
92 */
93 void endXPath() throws org.jaxen.saxpath.SAXPathException;
94
95 /*** Receive notification of the start of a path expression.
96 */
97 void startPathExpr() throws org.jaxen.saxpath.SAXPathException;
98
99 /*** Receive notification of the end of a path expression.
100 */
101 void endPathExpr() throws org.jaxen.saxpath.SAXPathException;
102
103 /*** Receive notification of the start of an absolute location path expression.
104 */
105 void startAbsoluteLocationPath() throws org.jaxen.saxpath.SAXPathException;
106
107 /*** Receive notification of the end of an absolute location path expression.
108 */
109 void endAbsoluteLocationPath() throws org.jaxen.saxpath.SAXPathException;
110
111 /*** Receive notification of the start of a relative location path expression.
112 */
113 void startRelativeLocationPath() throws org.jaxen.saxpath.SAXPathException;
114
115 /*** Receive notification of the end of a relative location path expression.
116 */
117 void endRelativeLocationPath() throws org.jaxen.saxpath.SAXPathException;
118
119 /*** Receive notification of the start of a name step.
120 *
121 * @param axis The axis of this step.
122 * @param prefix The namespace prefix for the name to test,
123 * or the empty-string if no prefix is specified.
124 * @param localName The local part of the name to test.
125 */
126 void startNameStep(int axis,
127 String prefix,
128 String localName) throws org.jaxen.saxpath.SAXPathException;
129
130 /*** Receive notification of the end of a NameStep
131 */
132 void endNameStep() throws org.jaxen.saxpath.SAXPathException;
133
134 /*** Receive notification of the start of a text() step.
135 *
136 * @param axis The axis of this step.
137 */
138 void startTextNodeStep(int axis) throws org.jaxen.saxpath.SAXPathException;
139
140 /*** Receive notification of the end of a text() step.
141 */
142 void endTextNodeStep() throws org.jaxen.saxpath.SAXPathException;
143
144 /*** Receive notification of the start of a comment() step.
145 *
146 * @param axis The axis of this step.
147 */
148 void startCommentNodeStep(int axis) throws org.jaxen.saxpath.SAXPathException;
149
150 /*** Receive notification of the end of a comment() step.
151 */
152 void endCommentNodeStep() throws org.jaxen.saxpath.SAXPathException;
153
154 /*** Receive notification of the start of a node() step.
155 *
156 * @param axis The axis of this step.
157 */
158 void startAllNodeStep(int axis) throws org.jaxen.saxpath.SAXPathException;
159
160 /*** Receive notification of the end of a node() step.
161 */
162 void endAllNodeStep() throws org.jaxen.saxpath.SAXPathException;
163
164 /*** Receive notification of the start of a processing-instruction(...) step.
165 *
166 * @param axis The axis of this step.
167 * @param name The name of the processing-instruction, of
168 * the empty-string if none is specified.
169 */
170 void startProcessingInstructionNodeStep(int axis,
171 String name) throws org.jaxen.saxpath.SAXPathException;
172
173 /*** Receive notification of the end of a processing-instruction(...) step.
174 */
175 void endProcessingInstructionNodeStep() throws org.jaxen.saxpath.SAXPathException;
176
177 /*** Receive notification of the start of a predicate.
178 */
179 void startPredicate() throws org.jaxen.saxpath.SAXPathException;
180
181 /*** Receive notification of the end of a predicate.
182 */
183 void endPredicate() throws org.jaxen.saxpath.SAXPathException;
184
185 /*** Receive notification of the start of a filter expression.
186 */
187 void startFilterExpr() throws org.jaxen.saxpath.SAXPathException;
188
189 /*** Receive notification of the end of a filter expression.
190 */
191 void endFilterExpr() throws org.jaxen.saxpath.SAXPathException;
192
193 /*** Receive notification of the start of an 'or' expression.
194 */
195 void startOrExpr() throws org.jaxen.saxpath.SAXPathException;
196
197 /*** Receive notification of the end of an 'or' expression.
198 *
199 * @param create Flag that indicates if this expression
200 * should truly be instantiated, or if it was just
201 * a pass-through, based upon the grammar productions.
202 */
203 void endOrExpr(boolean create) throws org.jaxen.saxpath.SAXPathException;
204
205 /*** Receive notification of the start of an 'and' expression.
206 */
207 void startAndExpr() throws org.jaxen.saxpath.SAXPathException;
208
209 /*** Receive notification of the end of an 'and' expression.
210 *
211 * @param create Flag that indicates if this expression
212 * should truly be instantiated, or if it was just
213 * a pass-through, based upon the grammar productions.
214 */
215 void endAndExpr(boolean create) throws org.jaxen.saxpath.SAXPathException;
216
217 /*** Receive notification of the start of an equality ('=' or '!=') expression.
218 */
219 void startEqualityExpr() throws org.jaxen.saxpath.SAXPathException;
220
221 /*** Receive notification of the end of an equality ('=' or '!=') expression.
222 *
223 * @param equalityOperator The operator specific to this particular
224 * equality expression. If null, this expression
225 * is only a pass-through, and should not actually
226 * be instantiated.
227 */
228 void endEqualityExpr(int equalityOperator) throws org.jaxen.saxpath.SAXPathException;
229
230 /*** Receive notification of the start of a relational ('<', '>', '<=', or '>=') expression.
231 */
232 void startRelationalExpr() throws org.jaxen.saxpath.SAXPathException;
233
234 /*** Receive notification of the start of a relational ('<', '>', '<=', or '>=') expression.
235 *
236 * @param relationalOperator The operator specific to this particular
237 * relational expression. If null, this expression
238 * is only a pass-through, and should not actually
239 * be instantiated.
240 */
241 void endRelationalExpr(int relationalOperator) throws org.jaxen.saxpath.SAXPathException;
242
243 /*** Receive notification of the start of an additive ('+' or '-') expression.
244 */
245 void startAdditiveExpr() throws org.jaxen.saxpath.SAXPathException;
246
247 /*** Receive notification of the end of an additive ('+' or '-') expression.
248 *
249 * @param additiveOperator The operator specific to this particular
250 * additive expression. If null, this expression
251 * is only a pass-through, and should not actually
252 * be instantiated.
253 */
254 void endAdditiveExpr(int additiveOperator) throws org.jaxen.saxpath.SAXPathException;
255
256 /*** Receive notification of the start of a multiplicative ('*', 'div' or 'mod') expression.
257 */
258 void startMultiplicativeExpr() throws org.jaxen.saxpath.SAXPathException;
259
260 /*** Receive notification of the start of a multiplicative ('*', 'div' or 'mod') expression.
261 *
262 * @param multiplicativeOperator The operator specific to this particular
263 * multiplicative expression. If null, this expression
264 * is only a pass-through, and should not actually
265 * be instantiated.
266 */
267 void endMultiplicativeExpr(int multiplicativeOperator) throws org.jaxen.saxpath.SAXPathException;
268
269 /*** Receive notification of the start of a unary ('+' or '-') expression.
270 */
271 void startUnaryExpr() throws org.jaxen.saxpath.SAXPathException;
272
273 /*** Receive notification of the end of a unary ('+' or '-') expression.
274 *
275 * @param unaryOperator The operator specific to this particular
276 * unary expression. If null, this expression is only
277 * a pass-through, and should not actually be instantiated.
278 * If not {@link org.jaxen.saxpath.Operator#NO_OP}, it'll always be {@link org.jaxen.saxpath.Operator#NEGATIVE}.
279 */
280 void endUnaryExpr(int unaryOperator) throws org.jaxen.saxpath.SAXPathException;
281
282 /*** Receive notification of the start of a union ('|') expression.
283 */
284 void startUnionExpr() throws org.jaxen.saxpath.SAXPathException;
285
286 /*** Receive notification of the end of a union ('|') expression.
287 *
288 * @param create Flag that indicates if this expression
289 * should truly be instantiated, or if it was just
290 * a pass-through, based upon the grammar productions.
291 */
292 void endUnionExpr(boolean create) throws org.jaxen.saxpath.SAXPathException;
293
294 /*** Receive notification of a number expression.
295 *
296 * @param number The number value.
297 */
298 void number(int number) throws org.jaxen.saxpath.SAXPathException;
299
300 /*** Receive notification of a number expression.
301 *
302 * @param number The number value.
303 */
304 void number(double number) throws org.jaxen.saxpath.SAXPathException;
305
306 /*** Receive notification of a literal expression.
307 *
308 * @param literal The string literal value.
309 */
310 void literal(String literal) throws org.jaxen.saxpath.SAXPathException;
311
312 /*** Receive notification of a variable-reference expression.
313 *
314 * @param prefix The ns-uri prefix of the variable.
315 * @param variableName The name of the variable.
316 */
317 void variableReference(String prefix,
318 String variableName) throws org.jaxen.saxpath.SAXPathException;
319
320 /*** Receive notification of a function call.
321 *
322 * @param prefix The ns-uri prefix of the function.
323 * @param functionName The name of the function.
324 */
325 void startFunction(String prefix,
326 String functionName) throws org.jaxen.saxpath.SAXPathException;
327
328 /*** Receive notification of the end of a function call.
329 */
330 void endFunction() throws org.jaxen.saxpath.SAXPathException;
331 }