Package org.apache.xml.dtm.ref
Class DTMNodeIterator
java.lang.Object
org.apache.xml.dtm.ref.DTMNodeIterator
- All Implemented Interfaces:
NodeIterator
public class DTMNodeIterator extends Object implements NodeIterator
DTMNodeIterator gives us an implementation of the
DTMNodeIterator which returns DOM nodes.
Please note that this is not necessarily equivlaent to a DOM
NodeIterator operating over the same document. In particular:
- If there are several Text nodes in logical succession (ie, across CDATASection and EntityReference boundaries), we will return only the first; the caller is responsible for stepping through them. (%REVIEW% Provide a convenience routine here to assist, pending proposed DOM Level 3 getAdjacentText() operation?)
- Since the whole XPath/XSLT architecture assumes that the source document is not altered while we're working with it, we do not promise to implement the DOM NodeIterator's "maintain current position" response to document mutation.
- Since our design for XPath NodeIterators builds a stateful filter directly into the traversal object, getNodeFilter() is not supported.
State: In progress!!
-
Constructor Summary
Constructors Constructor Description DTMNodeIterator(DTMIterator dtmIterator)Public constructor: Wrap a DTMNodeIterator around an existing and preconfigured DTMIterator -
Method Summary
Modifier and Type Method Description voiddetach()Detaches the NodeIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.DTMIteratorgetDTMIterator()Access the wrapped DTMIterator.booleangetExpandEntityReferences()The value of this flag determines whether the children of entity reference nodes are visible to the iterator.NodeFiltergetFilter()Return a handle to the filter used to screen nodes.NodegetRoot()The root node of theNodeIterator, as specified when it was created.intgetWhatToShow()Return a mask describing which node types are presented via the iterator.NodenextNode()Returns the next node in the set and advances the position of theNodeIteratorin the set.NodepreviousNode()Returns the previous node in the set and moves the position of theNodeIteratorbackwards in the set.
-
Constructor Details
-
DTMNodeIterator
Public constructor: Wrap a DTMNodeIterator around an existing and preconfigured DTMIterator
-
-
Method Details
-
getDTMIterator
Access the wrapped DTMIterator. I'm not sure whether anyone will need this or not, but let's write it and think about it. -
detach
public void detach()Detaches the NodeIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.- Specified by:
detachin interfaceNodeIterator
-
getExpandEntityReferences
public boolean getExpandEntityReferences()The value of this flag determines whether the children of entity reference nodes are visible to the iterator.- Specified by:
getExpandEntityReferencesin interfaceNodeIterator- Returns:
- false, always (the DTM model flattens entity references)
-
getFilter
Return a handle to the filter used to screen nodes. This is ill-defined in Xalan's usage of Nodeiterator, where we have built stateful XPath-based filtering directly into the traversal object. We could return something which supports the NodeFilter interface and allows querying whether a given node would be permitted if it appeared as our next node, but in the current implementation that would be very complex -- and just isn't all that useful.- Specified by:
getFilterin interfaceNodeIterator- Throws:
DOMException- -- NOT_SUPPORTED_ERROR because I can't think of anything more useful to do in this case
-
getRoot
Description copied from interface:NodeIteratorThe root node of theNodeIterator, as specified when it was created.- Specified by:
getRootin interfaceNodeIterator- Returns:
- The root node of the NodeIterator, as specified when it was created.
-
getWhatToShow
public int getWhatToShow()Return a mask describing which node types are presented via the iterator.- Specified by:
getWhatToShowin interfaceNodeIterator
-
nextNode
Description copied from interface:NodeIteratorReturns the next node in the set and advances the position of theNodeIteratorin the set. After aNodeIteratoris created, the first call tonextNode()returns the first node in the set.- Specified by:
nextNodein interfaceNodeIterator- Returns:
- the next node in the set and advance the position of the iterator in the set.
- Throws:
DOMException- - INVALID_STATE_ERR Raised if this method is called after the detach method was invoked.
-
previousNode
Description copied from interface:NodeIteratorReturns the previous node in the set and moves the position of theNodeIteratorbackwards in the set.- Specified by:
previousNodein interfaceNodeIterator- Returns:
- the next previous in the set and advance the position of the iterator in the set.
- Throws:
DOMException- - INVALID_STATE_ERR Raised if this method is called after the detach method was invoked.
-