org.apache.xml.dtm.ref
Class DTMNodeIterator

java.lang.Object
  extended byorg.apache.xml.dtm.ref.DTMNodeIterator
All Implemented Interfaces:
org.w3c.dom.traversal.NodeIterator

public class DTMNodeIterator
extends Object
implements org.w3c.dom.traversal.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:

State: In progress!!


Field Summary
private  DTMIterator dtm_iter
           
private  boolean valid
           
 
Constructor Summary
DTMNodeIterator(DTMIterator dtmIterator)
          Public constructor: Wrap a DTMNodeIterator around an existing and preconfigured DTMIterator
 
Method Summary
 void detach()
          Detaches the NodeIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
 DTMIterator getDTMIterator()
          Access the wrapped DTMIterator.
 boolean getExpandEntityReferences()
          The value of this flag determines whether the children of entity reference nodes are visible to the iterator.
 org.w3c.dom.traversal.NodeFilter getFilter()
          Return a handle to the filter used to screen nodes.
 org.w3c.dom.Node getRoot()
           
 int getWhatToShow()
          Return a mask describing which node types are presented via the iterator.
 org.w3c.dom.Node nextNode()
           
 org.w3c.dom.Node previousNode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dtm_iter

private DTMIterator dtm_iter

valid

private boolean valid
Constructor Detail

DTMNodeIterator

public DTMNodeIterator(DTMIterator dtmIterator)
Public constructor: Wrap a DTMNodeIterator around an existing and preconfigured DTMIterator

Method Detail

getDTMIterator

public DTMIterator 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:
detach in interface org.w3c.dom.traversal.NodeIterator

getExpandEntityReferences

public boolean getExpandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the iterator.

Specified by:
getExpandEntityReferences in interface org.w3c.dom.traversal.NodeIterator
Returns:
false, always (the DTM model flattens entity references)

getFilter

public org.w3c.dom.traversal.NodeFilter 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:
getFilter in interface org.w3c.dom.traversal.NodeIterator
Throws:
org.w3c.dom.DOMException - -- NOT_SUPPORTED_ERROR because I can't think of anything more useful to do in this case

getRoot

public org.w3c.dom.Node getRoot()
Specified by:
getRoot in interface org.w3c.dom.traversal.NodeIterator
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:
getWhatToShow in interface org.w3c.dom.traversal.NodeIterator

nextNode

public org.w3c.dom.Node nextNode()
                          throws org.w3c.dom.DOMException
Specified by:
nextNode in interface org.w3c.dom.traversal.NodeIterator
Returns:
the next node in the set and advance the position of the iterator in the set.
Throws:
org.w3c.dom.DOMException

previousNode

public org.w3c.dom.Node previousNode()
Specified by:
previousNode in interface org.w3c.dom.traversal.NodeIterator
Returns:
the next previous in the set and advance the position of the iterator in the set.