01: /*
02: * Copyright 1999-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: /*
17: * $Id: AttributeIterator.java,v 1.16 2004/08/17 19:25:34 jycli Exp $
18: */
19: package org.apache.xpath.axes;
20:
21: import org.apache.xml.dtm.DTM;
22: import org.apache.xpath.compiler.Compiler;
23:
24: /**
25: * This class implements an optimized iterator for
26: * attribute axes patterns.
27: * @see org.apache.xpath.axes#ChildTestIterator
28: * @xsl.usage advanced
29: */
30: public class AttributeIterator extends ChildTestIterator {
31: static final long serialVersionUID = -8417986700712229686L;
32:
33: /**
34: * Create a AttributeIterator object.
35: *
36: * @param compiler A reference to the Compiler that contains the op map.
37: * @param opPos The position within the op map, which contains the
38: * location path expression for this itterator.
39: *
40: * @throws javax.xml.transform.TransformerException
41: */
42: AttributeIterator(Compiler compiler, int opPos, int analysis)
43: throws javax.xml.transform.TransformerException {
44: super (compiler, opPos, analysis);
45: }
46:
47: /**
48: * Get the next node via getFirstAttribute && getNextAttribute.
49: */
50: protected int getNextNode() {
51: m_lastFetched = (DTM.NULL == m_lastFetched) ? m_cdtm
52: .getFirstAttribute(m_context) : m_cdtm
53: .getNextAttribute(m_lastFetched);
54: return m_lastFetched;
55: }
56:
57: /**
58: * Returns the axis being iterated, if it is known.
59: *
60: * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple
61: * types.
62: */
63: public int getAxis() {
64: return org.apache.xml.dtm.Axis.ATTRIBUTE;
65: }
66:
67: }
|