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 attribute xpath axis.
56 *
57 * @author Bob McWhirter
58 * @author James Strachan
59 * @author Stephen Colebourne
60 */
61 public class IterableAttributeAxis extends IterableAxis {
62
63 /***
64 * Constructor.
65 *
66 * @param value the axis value
67 */
68 public IterableAttributeAxis(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) throws UnsupportedAxisException {
79 return support.getNavigator().getAttributeAxisIterator(contextNode);
80 }
81
82 /***
83 * Gets the iterator for the attribute xpath axis that supports named access.
84 *
85 * @param contextNode the current context node to work from
86 * @param support the additional context information
87 * @param localName the local name of the attributes to return
88 * @param namespacePrefix the prefix of the namespace of the attributes to return
89 * @param namespaceURI the uri of the namespace of the attributes to return
90 */
91 public Iterator namedAccessIterator(
92 Object contextNode,
93 ContextSupport support,
94 String localName,
95 String namespacePrefix,
96 String namespaceURI)
97 throws UnsupportedAxisException {
98
99 NamedAccessNavigator nav = (NamedAccessNavigator) support.getNavigator();
100 return nav.getAttributeAxisIterator(contextNode, localName, namespacePrefix, namespaceURI);
101 }
102
103 /***
104 * Does this axis support named access?
105 *
106 * @param support the additional context information
107 * @return true if named access supported. If not iterator() will be used.
108 */
109 public boolean supportsNamedAccess(ContextSupport support) {
110 return (support.getNavigator() instanceof NamedAccessNavigator);
111 }
112
113 }