You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jk...@apache.org on 2001/05/21 19:22:46 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/dtm DTMTreeWalker.java

jkesselm    01/05/21 10:22:45

  Modified:    java/src/org/apache/xml/dtm Tag: DTM_EXP DTMTreeWalker.java
  Log:
  Docs, flag a possible bug
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +20 -13    xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMTreeWalker.java
  
  Index: DTMTreeWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMTreeWalker.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- DTMTreeWalker.java	2001/05/18 07:16:38	1.1.2.6
  +++ DTMTreeWalker.java	2001/05/21 17:22:40	1.1.2.7
  @@ -131,24 +131,25 @@
       m_dtm = dtm;
     }
     
  -  /**
  -   * Perform a pre-order traversal non-recursive style.
  +  /** Perform a non-recursive pre-order/post-order traversal,
  +   * operating as a Visitor. startNode (preorder) and endNode
  +   * (postorder) are invoked for each node as we traverse over them,
  +   * with the result that the node is written out to m_contentHandler.
      *
  -   * @param pos Node in the tree where to start traversal
  +   * @param pos Node in the tree at which to start (and end) traversal --
  +   * in other words, the root of the subtree to traverse over.
      *
  -   * @throws TransformerException
  -   */
  +   * @throws TransformerException */
     public void traverse(int pos) throws org.xml.sax.SAXException
     {
  +    // %REVIEW% Why isn't this just traverse(pos,pos)?
   
  -    int top = pos;
  +    int top = pos;		// Remember the root of this subtree
   
       while (DTM.NULL != pos)
       {
         startNode(pos);
  -
         int nextNode = m_dtm.getFirstChild(pos);
  -
         while (DTM.NULL == nextNode)
         {
           endNode(pos);
  @@ -164,6 +165,8 @@
   
             if ((DTM.NULL == pos) || (top == pos))
             {
  +	    // %REVIEW% This condition isn't tested in traverse(pos,top)
  +	    // -- bug?
               if (DTM.NULL != pos)
                 endNode(pos);
   
  @@ -178,23 +181,27 @@
       }
     }
   
  -  /**
  -   * Perform a pre-order traversal non-recursive style.
  +  /** Perform a non-recursive pre-order/post-order traversal,
  +   * operating as a Visitor. startNode (preorder) and endNode
  +   * (postorder) are invoked for each node as we traverse over them,
  +   * with the result that the node is written out to m_contentHandler.
      *
      * @param pos Node in the tree where to start traversal
  -   * @param top Node in the tree where to end traversal
  +   * @param top Node in the tree where to end traversal.
  +   * If top==DTM.NULL, run through end of document.
      *
      * @throws TransformerException
      */
     public void traverse(int pos, int top) throws org.xml.sax.SAXException
     {
  +    // %OPT% Can we simplify the loop conditionals by adding:
  +    //		if(top==DTM.NULL) top=0
  +    // ?
   
       while (DTM.NULL != pos)
       {
         startNode(pos);
  -
         int nextNode = m_dtm.getFirstChild(pos);
  -
         while (DTM.NULL == nextNode)
         {
           endNode(pos);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org