Class NodeTraversor


  • public class NodeTraversor
    extends Object
    Depth-first node traversor. Use to iterate through all nodes under and including the specified root node.

    This implementation does not use recursion, so a deep DOM does not risk blowing the stack.

    • Constructor Detail

      • NodeTraversor

        public NodeTraversor​(NodeVisitor visitor)
        Create a new traversor.
        Parameters:
        visitor - a class implementing the NodeVisitor interface, to be called when visiting each node.
    • Method Detail

      • traverse

        public void traverse​(Node root)
        Start a depth-first traverse of the root and all of its descendants.
        Parameters:
        root - the root node point to traverse.