View Javadoc

    1   package net.sourceforge.pmd.lang.ast.xpath.saxon;
    2
    3   import net.sf.saxon.om.Navigator;
    4   import net.sf.saxon.om.SequenceIterator;
    5   import net.sourceforge.pmd.lang.ast.xpath.Attribute;
    6
    7   /**
    8    * This is an Attribute axis iterator.
    9    */
    10  public class AttributeAxisIterator extends Navigator.BaseEnumeration {
    11
    12      protected final ElementNode startNodeInfo;
    13      protected final net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator iterator;
    14
    15      /**
    16       * Create an iterator over the Attribute axis for the given ElementNode.
    17       * @see net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator
    18       */
    19      public AttributeAxisIterator(ElementNode startNodeInfo) {
    20  	this.startNodeInfo = startNodeInfo;
    21  	this.iterator = new net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator(startNodeInfo.node);
    22      }
    23
    24      /**
    25       * {@inheritDoc}
    26       */
    27      public SequenceIterator getAnother() {
    28  	return new AttributeAxisIterator(startNodeInfo);
    29      }
    30
    31      /**
    32       * {@inheritDoc}
    33       */
    34      public void advance() {
    35  	if (this.iterator.hasNext()) {
    36  	    Attribute attribute = this.iterator.next();
    37  	    super.current = new AttributeNode(attribute, super.position());
    38  	} else {
    39  	    super.current = null;
    40  	}
    41      }
    42  }