FileDocCategorySizeDatePackage
ChildIterator.javaAPI DocJava SE 6 API3556Tue Jun 10 00:23:14 BST 2008com.sun.org.apache.xpath.internal.axes

ChildIterator

public class ChildIterator extends LocPathIterator
This class implements an optimized iterator for "node()" patterns, that is, any children of the context node.
see
com.sun.org.apache.xpath.internal.axes.LocPathIterator
xsl.usage
advanced

Fields Summary
static final long
serialVersionUID
Constructors Summary
ChildIterator(Compiler compiler, int opPos, int analysis)
Create a ChildIterator object.

param
compiler A reference to the Compiler that contains the op map.
param
opPos The position within the op map, which contains the location path expression for this itterator.
param
analysis Analysis bits of the entire pattern.
throws
javax.xml.transform.TransformerException


                                                
       
           
  
    super(compiler, opPos, analysis, false);

    // This iterator matches all kinds of nodes
    initNodeTest(DTMFilter.SHOW_ALL);
  
Methods Summary
public intasNode(com.sun.org.apache.xpath.internal.XPathContext xctxt)
Return the first node out of the nodeset, if this expression is a nodeset expression. This is the default implementation for nodesets.

WARNING: Do not mutate this class from this function!

param
xctxt The XPath runtime context.
return
the first node out of the nodeset, or DTM.NULL.

    int current = xctxt.getCurrentNode();
    
    DTM dtm = xctxt.getDTM(current);
    
    return dtm.getFirstChild(current);
  
public intgetAxis()
Returns the axis being iterated, if it is known.

return
Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.

    return com.sun.org.apache.xml.internal.dtm.Axis.CHILD;
  
public intnextNode()
Returns the next node in the set and advances the position of the iterator in the set. After a NodeIterator is created, the first call to nextNode() returns the first node in the set.

return
The next Node in the set being iterated over, or null if there are no more members in that set.

  	if(m_foundLast)
  		return DTM.NULL;

    int next;

    m_lastFetched = next = (DTM.NULL == m_lastFetched)
                           ? m_cdtm.getFirstChild(m_context)
                           : m_cdtm.getNextSibling(m_lastFetched);

    // m_lastFetched = next;
    if (DTM.NULL != next)
    {
      m_pos++;
      return next;
    }
    else
    {
      m_foundLast = true;

      return DTM.NULL;
    }