XML Parser for Java 1.1.16

com.ibm.xml.parser.util
Class RecursivePreorderTreeTraversal

java.lang.Object
  |
  +--com.ibm.xml.parser.TreeTraversal
        |
        +--com.ibm.xml.parser.util.RecursivePreorderTreeTraversal

public class RecursivePreorderTreeTraversal
extends TreeTraversal

RecursivePreorderTreeTraversal defines a specific document object tree traversal algorithm for use by the visitor design pattern. This algorithm visits the Parent before visiting its children.

Version:
Revision: 47 1.6 src/com/ibm/xml/parser/util/RecursivePreorderTreeTraversal.java, xml4jsrc, xml4j-jtcsv, xml4j_1_1_16
See Also:
TreeTraversal, NonRecursivePreorderTreeTraversal

Constructor Summary
RecursivePreorderTreeTraversal(Visitor visitor)
          Constructor.
 
Method Summary
 void traverse(Node node)
          Traverses the document object tree at the specified node.
 
Methods inherited from class com.ibm.xml.parser.TreeTraversal
getVisitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecursivePreorderTreeTraversal

public RecursivePreorderTreeTraversal(Visitor visitor)
Constructor.
Parameters:
visitor - The implemention of the Visitor operation (toXMLString, digest, ...)
See Also:
Visitor
Method Detail

traverse

public void traverse(Node node)
              throws java.lang.Exception
Traverses the document object tree at the specified node.

The numbered nodes in the trees below indicate the order of traversal given the specified node of "1".


                 1              x              x
                / \            / \            / \
               2   6          1   x          x   x
              /|\   \        /|\   \        /|\   \
             3 4 5   7      2 3 4   x      x 1 x   x

 

Once this method is invoked, the RecursivePreorderTreeTraversal instance is of no further use, and should NOT be reused.

Parameters:
node - The starting point to begin traversing the document object tree.
Throws:
java.lang.Exception - Thrown if the document hierarchy can not be visitted.
Overrides:
traverse in class TreeTraversal

XML Parser for Java 1.1.16