Class DomNode.DescendantElementsIterator<T extends DomNode>

  • Type Parameters:
    T - the type of nodes over which to iterate
    All Implemented Interfaces:
    java.util.Iterator<T>
    Enclosing class:
    DomNode

    protected class DomNode.DescendantElementsIterator<T extends DomNode>
    extends java.lang.Object
    implements java.util.Iterator<T>
    Iterates over all descendants of a specific type, in document order.
    • Field Detail

      • currentNode_

        private DomNode currentNode_
      • nextNode_

        private DomNode nextNode_
      • type_

        private final java.lang.Class<T extends DomNode> type_
    • Constructor Detail

      • DescendantElementsIterator

        public DescendantElementsIterator​(java.lang.Class<T> type)
        Creates a new instance which iterates over the specified node type.
        Parameters:
        type - the type of nodes over which to iterate
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<T extends DomNode>
      • next

        public T next()
        Specified by:
        next in interface java.util.Iterator<T extends DomNode>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<T extends DomNode>
      • nextNode

        public T nextNode()
        Returns:
        the next node, if there is one
      • setNextElement

        private void setNextElement()
      • getNextElementUpwards

        private DomNode getNextElementUpwards​(DomNode startingNode)
      • getFirstChildElement

        private DomNode getFirstChildElement​(DomNode parent)
      • isAccepted

        protected boolean isAccepted​(DomNode node)
        Indicates if the node is accepted. If not it won't be explored at all.
        Parameters:
        node - the node to test
        Returns:
        true if accepted
      • getNextDomSibling

        private DomNode getNextDomSibling​(DomNode element)