mmidy       01/04/06 07:36:23

  Modified:    java/src/org/apache/xml/utils TreeWalker.java
  Log:
  Add locator support to TreeWalker
  
  Revision  Changes    Path
  1.8       +12 -0     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TreeWalker.java   2001/03/13 16:30:53     1.7
  +++ TreeWalker.java   2001/04/06 14:36:22     1.8
  @@ -60,6 +60,7 @@
   
   import org.xml.sax.*;
   import org.xml.sax.ext.LexicalHandler;
  +import org.xml.sax.helpers.LocatorImpl;
   
   import org.apache.xpath.DOM2Helper;
   import org.apache.xpath.DOMHelper;
  @@ -81,6 +82,9 @@
   
     /** DomHelper for this TreeWalker          */
     protected DOMHelper m_dh;
  +     
  +     /** Locator object for this TreeWalker          */
  +     private Locator m_locator = new LocatorImpl();
   
     /**
      * Get the ContentHandler used for the tree walk.
  @@ -100,6 +104,7 @@
     public TreeWalker(ContentHandler contentHandler, DOMHelper dh)
     {
       this.m_contentHandler = contentHandler;
  +             m_contentHandler.setDocumentLocator(m_locator);
       m_dh = dh;
     }
     
  @@ -111,6 +116,7 @@
     public TreeWalker(ContentHandler contentHandler)
     {
       this.m_contentHandler = contentHandler;
  +             m_contentHandler.setDocumentLocator(m_locator);
       m_dh = new org.apache.xpath.DOM2Helper();
     }
   
  @@ -239,6 +245,12 @@
       {
         ((NodeConsumer) m_contentHandler).setOriginatingNode(node);
       }
  +             
  +             if (node instanceof Locator)
  +             {
  +                     m_locator = (Locator)node;
  +                     m_contentHandler.setDocumentLocator(m_locator);
  +             }
   
       switch (node.getNodeType())
       {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to