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