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