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 package org.jaxen;
51
52 import java.util.Iterator;
53
54 import org.jaxen.pattern.Pattern;
55 import org.jaxen.util.AncestorAxisIterator;
56 import org.jaxen.util.AncestorOrSelfAxisIterator;
57 import org.jaxen.util.DescendantAxisIterator;
58 import org.jaxen.util.DescendantOrSelfAxisIterator;
59 import org.jaxen.util.FollowingAxisIterator;
60 import org.jaxen.util.FollowingSiblingAxisIterator;
61 import org.jaxen.util.PrecedingAxisIterator;
62 import org.jaxen.util.PrecedingSiblingAxisIterator;
63 import org.jaxen.util.SelfAxisIterator;
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84 public abstract class DefaultNavigator implements Navigator
85 {
86
87
88
89
90
91
92
93 public Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException
94 {
95 throw new UnsupportedAxisException("child");
96 }
97
98
99
100
101 public Iterator getDescendantAxisIterator(Object contextNode) throws UnsupportedAxisException
102 {
103 return new DescendantAxisIterator( contextNode,
104 this );
105 }
106
107
108
109
110
111
112
113 public Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException
114 {
115 throw new UnsupportedAxisException("parent");
116 }
117
118 public Iterator getAncestorAxisIterator(Object contextNode) throws UnsupportedAxisException
119 {
120 return new AncestorAxisIterator( contextNode,
121 this );
122 }
123
124
125 public Iterator getFollowingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException
126 {
127 return new FollowingSiblingAxisIterator( contextNode,
128 this );
129 }
130
131
132 public Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException
133 {
134 return new PrecedingSiblingAxisIterator( contextNode,
135 this );
136 }
137
138 public Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException
139 {
140 return new FollowingAxisIterator( contextNode,
141 this );
142
143
144 }
145
146
147 public Iterator getPrecedingAxisIterator(Object contextNode) throws UnsupportedAxisException
148 {
149 return new PrecedingAxisIterator( contextNode,
150 this );
151
152
153 }
154
155
156
157
158
159
160
161
162 public Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException
163 {
164 throw new UnsupportedAxisException("attribute");
165 }
166
167
168
169
170
171
172
173
174 public Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException
175 {
176 throw new UnsupportedAxisException("namespace");
177 }
178
179 public Iterator getSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
180 {
181 return new SelfAxisIterator( contextNode );
182 }
183
184 public Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
185 {
186 return new DescendantOrSelfAxisIterator( contextNode,
187 this );
188 }
189
190 public Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
191 {
192 return new AncestorOrSelfAxisIterator( contextNode,
193 this );
194 }
195
196 public Object getDocumentNode(Object contextNode)
197 {
198 return null;
199 }
200
201 public String translateNamespacePrefixToUri(String prefix, Object element)
202 {
203 return null;
204 }
205
206 public String getProcessingInstructionTarget(Object obj)
207 {
208 return null;
209 }
210
211 public String getProcessingInstructionData(Object obj)
212 {
213 return null;
214 }
215
216 public short getNodeType(Object node)
217 {
218 if ( isElement(node) )
219 {
220 return Pattern.ELEMENT_NODE;
221 }
222 else if ( isAttribute(node) )
223 {
224 return Pattern.ATTRIBUTE_NODE;
225 }
226 else if ( isText(node) )
227 {
228 return Pattern.TEXT_NODE;
229 }
230 else if ( isComment(node) )
231 {
232 return Pattern.COMMENT_NODE;
233 }
234 else if ( isDocument(node) )
235 {
236 return Pattern.DOCUMENT_NODE;
237 }
238 else if ( isProcessingInstruction(node) )
239 {
240 return Pattern.PROCESSING_INSTRUCTION_NODE;
241 }
242 else if ( isNamespace(node) )
243 {
244 return Pattern.NAMESPACE_NODE;
245 }
246 else {
247 return Pattern.UNKNOWN_NODE;
248 }
249 }
250
251
252
253
254
255
256
257
258
259 public Object getParentNode(Object contextNode) throws UnsupportedAxisException
260 {
261 Iterator iter = getParentAxisIterator( contextNode );
262 if ( iter != null && iter.hasNext() )
263 {
264 return iter.next();
265 }
266 return null;
267 }
268
269
270
271
272
273
274
275
276
277
278
279 public Object getDocument(String url) throws FunctionCallException
280 {
281 return null;
282 }
283
284
285
286
287
288
289
290
291
292
293
294 public Object getElementById(Object contextNode, String elementId)
295 {
296 return null;
297 }
298
299 }