ChildIteratorpublic class ChildIterator extends LocPathIterator This class implements an optimized iterator for
"node()" patterns, that is, any children of the
context node. |
Fields Summary |
---|
static final long | serialVersionUID |
Constructors Summary |
---|
ChildIterator(Compiler compiler, int opPos, int analysis)Create a ChildIterator object.
super(compiler, opPos, analysis, false);
// This iterator matches all kinds of nodes
initNodeTest(DTMFilter.SHOW_ALL);
|
Methods Summary |
---|
public int | asNode(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!
int current = xctxt.getCurrentNode();
DTM dtm = xctxt.getDTM(current);
return dtm.getFirstChild(current);
| public int | getAxis()Returns the axis being iterated, if it is known.
return com.sun.org.apache.xml.internal.dtm.Axis.CHILD;
| public int | nextNode()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.
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;
}
|
|