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 package org.jaxen.expr.iter;
47
48 import java.util.Iterator;
49
50 import org.jaxen.ContextSupport;
51 import org.jaxen.NamedAccessNavigator;
52 import org.jaxen.UnsupportedAxisException;
53
54 /***
55 * Provide access to the child xpath axis.
56 *
57 * @author Bob McWhirter
58 * @author James Strachan
59 * @author Stephen Colebourne
60 */
61 public class IterableChildAxis extends IterableAxis {
62
63 /***
64 * Constructor.
65 *
66 * @param value the axis value
67 */
68 public IterableChildAxis(int value) {
69 super(value);
70 }
71
72 /***
73 * Gets the iterator for the child xpath axis.
74 *
75 * @param contextNode the current context node to work from
76 * @param support the additional context information
77 */
78 public Iterator iterator(Object contextNode, ContextSupport support)
79 throws UnsupportedAxisException {
80 return support.getNavigator().getChildAxisIterator(contextNode);
81 }
82
83 /***
84 * Gets the iterator for the child xpath axis that supports named access.
85 *
86 * @param contextNode the current context node to work from
87 * @param support the additional context information
88 * @param localName the local name of the children to return
89 * @param namespacePrefix the prefix of the namespace of the children to return
90 * @param namespaceURI the URI of the namespace of the children to return
91 */
92 public Iterator namedAccessIterator(
93 Object contextNode,
94 ContextSupport support,
95 String localName,
96 String namespacePrefix,
97 String namespaceURI)
98 throws UnsupportedAxisException {
99
100 NamedAccessNavigator nav = (NamedAccessNavigator) support.getNavigator();
101 return nav.getChildAxisIterator(contextNode, localName, namespacePrefix, namespaceURI);
102 }
103
104 /***
105 * Does this axis support named access?
106 *
107 * @param support the additional context information
108 * @return true if named access supported. If not iterator() will be used
109 */
110 public boolean supportsNamedAccess(ContextSupport support) {
111 return (support.getNavigator() instanceof NamedAccessNavigator);
112 }
113
114 }