xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From il...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xml/utils TreeWalker.java
Date Mon, 29 Jul 2002 21:51:15 GMT
ilene       2002/07/29 14:51:15

  Modified:    java/src/org/apache/xml/utils TreeWalker.java
  Log:
  Patch for bugzilla #9146
  
  NullPointerException when attempting to build a stylesheet from 
  a DOM Element instead of a Document node.
  
  Revision  Changes    Path
  1.15      +20 -3     xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java
  
  Index: TreeWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TreeWalker.java	11 Oct 2001 15:01:35 -0000	1.14
  +++ TreeWalker.java	29 Jul 2002 21:51:15 -0000	1.15
  @@ -71,6 +71,7 @@
    * This class does a pre-order walk of the DOM tree, calling a ContentHandler
    * interface as it goes.
    */
  +
   public class TreeWalker
   {
   
  @@ -167,8 +168,13 @@
     }
   
     /**
  -   * Perform a pre-order traversal non-recursive style.
  +   * Perform a pre-order traversal non-recursive style.  
      *
  +   * Note that TreeWalker assumes that the subtree is intended to represent 
  +   * a complete (though not necessarily well-formed) document and, during a 
  +   * traversal, startDocument and endDocument will always be issued to the 
  +   * SAX listener.
  +   *  
      * @param pos Node in the tree where to start traversal
      *
      * @throws TransformerException
  @@ -176,6 +182,8 @@
     public void traverse(Node pos) throws org.xml.sax.SAXException
     {
   
  +   	this.m_contentHandler.startDocument();
  +
       Node top = pos;
   
       while (null != pos)
  @@ -211,10 +219,16 @@
   
         pos = nextNode;
       }
  +    this.m_contentHandler.endDocument();
     }
   
     /**
      * Perform a pre-order traversal non-recursive style.
  +
  +   * Note that TreeWalker assumes that the subtree is intended to represent 
  +   * a complete (though not necessarily well-formed) document and, during a 
  +   * traversal, startDocument and endDocument will always be issued to the 
  +   * SAX listener.
      *
      * @param pos Node in the tree where to start traversal
      * @param top Node in the tree where to end traversal
  @@ -224,6 +238,8 @@
     public void traverse(Node pos, Node top) throws org.xml.sax.SAXException
     {
   
  +	this.m_contentHandler.startDocument();
  +	
       while (null != pos)
       {
         startNode(pos);
  @@ -254,6 +270,7 @@
   
         pos = nextNode;
       }
  +    this.m_contentHandler.endDocument();
     }
   
     /** Flag indicating whether following text to be processed is raw text          */
  @@ -325,7 +342,7 @@
         // ??;
         break;
       case Node.DOCUMENT_NODE :
  -      this.m_contentHandler.startDocument();
  +    
         break;
       case Node.ELEMENT_NODE :
         NamedNodeMap atts = ((Element) node).getAttributes();
  @@ -454,8 +471,8 @@
       switch (node.getNodeType())
       {
       case Node.DOCUMENT_NODE :
  -      this.m_contentHandler.endDocument();
         break;
  +      
       case Node.ELEMENT_NODE :
         String ns = m_dh.getNamespaceOfNode(node);
         if(null == ns)
  
  
  

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


Mime
View raw message