KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xpath > internal > axes > AttributeIterator


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.15 2004/02/17 04:32:08 minchau Exp $
18  */

19 package com.sun.org.apache.xpath.internal.axes;
20
21 import com.sun.org.apache.xml.internal.dtm.DTM;
22 import com.sun.org.apache.xpath.internal.compiler.Compiler;
23
24 /**
25  * This class implements an optimized iterator for
26  * attribute axes patterns.
27  * @see com.sun.org.apache.xpath.internal.axes#ChildTestIterator
28  * @xsl.usage advanced
29  */

30 public class AttributeIterator extends ChildTestIterator
31 {
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 JavaDoc compiler, int opPos, int analysis)
43           throws javax.xml.transform.TransformerException JavaDoc
44   {
45     super(compiler, opPos, analysis);
46   }
47     
48   /**
49    * Get the next node via getFirstAttribute && getNextAttribute.
50    */

51   protected int getNextNode()
52   {
53     m_lastFetched = (DTM.NULL == m_lastFetched)
54                      ? m_cdtm.getFirstAttribute(m_context)
55                      : m_cdtm.getNextAttribute(m_lastFetched);
56     return m_lastFetched;
57   }
58   
59   /**
60    * Returns the axis being iterated, if it is known.
61    *
62    * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple
63    * types.
64    */

65   public int getAxis()
66   {
67     return com.sun.org.apache.xml.internal.dtm.Axis.ATTRIBUTE;
68   }
69
70
71
72 }
73
Popular Tags