Class DOMSubTreeData.DelayedNodeIterator

  • All Implemented Interfaces:
    java.util.Iterator<org.w3c.dom.Node>
    Enclosing class:
    DOMSubTreeData

    static class DOMSubTreeData.DelayedNodeIterator
    extends java.lang.Object
    implements java.util.Iterator<org.w3c.dom.Node>
    This is an Iterator that contains a backing node-set that is not populated until the caller first attempts to advance the iterator.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ListIterator<org.w3c.dom.Node> li  
      private java.util.List<org.w3c.dom.Node> nodeSet  
      private org.w3c.dom.Node root  
      private boolean withComments  
    • Constructor Summary

      Constructors 
      Constructor Description
      DelayedNodeIterator​(org.w3c.dom.Node root, boolean excludeComments)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.List<org.w3c.dom.Node> dereferenceSameDocumentURI​(org.w3c.dom.Node node)
      Dereferences a same-document URI fragment.
      boolean hasNext()  
      org.w3c.dom.Node next()  
      private void nodeSetMinusCommentNodes​(org.w3c.dom.Node node, java.util.List<org.w3c.dom.Node> nodeSet, org.w3c.dom.Node prevSibling)
      Recursively traverses the subtree, and returns an XPath-equivalent node-set of all nodes traversed, excluding any comment nodes, if specified.
      void remove()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Field Detail

      • root

        private org.w3c.dom.Node root
      • nodeSet

        private java.util.List<org.w3c.dom.Node> nodeSet
      • li

        private java.util.ListIterator<org.w3c.dom.Node> li
      • withComments

        private boolean withComments
    • Constructor Detail

      • DelayedNodeIterator

        DelayedNodeIterator​(org.w3c.dom.Node root,
                            boolean excludeComments)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<org.w3c.dom.Node>
      • next

        public org.w3c.dom.Node next()
        Specified by:
        next in interface java.util.Iterator<org.w3c.dom.Node>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<org.w3c.dom.Node>
      • dereferenceSameDocumentURI

        private java.util.List<org.w3c.dom.Node> dereferenceSameDocumentURI​(org.w3c.dom.Node node)
        Dereferences a same-document URI fragment.
        Parameters:
        node - the node (document or element) referenced by the URI fragment. If null, returns an empty set.
        Returns:
        a set of nodes (minus any comment nodes)
      • nodeSetMinusCommentNodes

        private void nodeSetMinusCommentNodes​(org.w3c.dom.Node node,
                                              java.util.List<org.w3c.dom.Node> nodeSet,
                                              org.w3c.dom.Node prevSibling)
        Recursively traverses the subtree, and returns an XPath-equivalent node-set of all nodes traversed, excluding any comment nodes, if specified.
        Parameters:
        node - the node to traverse
        nodeSet - the set of nodes traversed so far
        prevSibling - the previous sibling node