net.sf.saxon.om
Interface SequenceIterator
- All Known Subinterfaces:
- AtomizableIterator, AxisIterator, GroupIterator, LastPositionFinder, LookaheadIterator, ReversibleIterator
- All Known Implementing Classes:
- AppendExpression.AppendIterator, ArrayIterator, AxisIteratorImpl, Closure.ProgressiveIterator, DifferenceEnumeration, DocumentOrderIterator, EmptyIterator, FilterIterator, GroupAdjacentIterator, GroupByIterator, GroupEndingIterator, GroupStartingIterator, IntersectionEnumeration, ListIterator, MappingIterator, PositionIterator, RegexIterator, ReverseArrayIterator, SingletonIterator, SortedGroupIterator, SortedIterator, StringTokenIterator, StringValue.CharacterIterator, TailExpression.TailIterator, Tokenize.TokenIterator, Trace.TracingIterator, UnionEnumeration
- public interface SequenceIterator
A SequenceIterator is used to iterate over any XPath 2 sequence (of values or nodes).
To get the next item in a sequence, call next(); if this returns null, you've
reached the end of the sequence.
A SequenceIterator keeps track of the current Item and the current position.
The objects returned by the SequenceIterator will always be either nodes
(class NodeInfo) or singleton values (class AtomicValue): these are represented
collectively by the interface Item.
Method Summary |
Item |
current()
Get the current value in the sequence (the one returned by the
most recent call on next()). |
SequenceIterator |
getAnother()
Get another SequenceIterator that iterates over the same items as the original,
but which is repositioned at the start of the sequence. |
Item |
next()
Get the next item in the sequence. |
int |
position()
Get the current position. |
next
public Item next()
throws XPathException
- Get the next item in the sequence.
- Returns:
- the next item, or null if there are no more items.
- Throws:
XPathException
- if an error occurs retrieving the next item
current
public Item current()
- Get the current value in the sequence (the one returned by the
most recent call on next()). This will be null before the first
call of next().
- Returns:
- the current item, the one most recently returned by a call on
next(); or null, if next() has not been called, or if the end
of the sequence has been reached.
position
public int position()
- Get the current position. This will be zero before the first call
on next(), otherwise it will be the number of times that next() has
been called.
- Returns:
- the current position, the position of the item returned by the
most recent call of next()
getAnother
public SequenceIterator getAnother()
throws XPathException
- Get another SequenceIterator that iterates over the same items as the original,
but which is repositioned at the start of the sequence.
- Returns:
- a SequenceIterator that iterates over the same items,
positioned before the first item
- Throws:
XPathException
- if any error occurs