ilene       2003/04/04 17:06:08

  Modified:    java/src/org/apache/xml/utils TreeWalker.java
  Log:
  Instead of setting a default baseURI in newTemplates, append a dummy string
  to the default used in the TreeWalker constructors.  This solves the problem
  of violating the SourceLocator.getSystemId API which should return null
  if if no systemId was set, while allowing relative URI's to be resolved when
  the source is a DOM and no systemID has been set.  Relative URI's are already 
  resolved correctly for other source types.
  
  Revision  Changes    Path
  1.19      +21 -13    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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TreeWalker.java   30 Jan 2003 18:46:19 -0000      1.18
  +++ TreeWalker.java   5 Apr 2003 01:06:08 -0000       1.19
  @@ -56,6 +56,8 @@
    */
   package org.apache.xml.utils;
   
  +import java.io.File;
  +
   import org.w3c.dom.Comment;
   import org.w3c.dom.Element;
   import org.w3c.dom.EntityReference;
  @@ -119,17 +121,19 @@
     public TreeWalker(ContentHandler contentHandler, DOMHelper dh, String 
systemId)
     {
       this.m_contentHandler = contentHandler;
  -                m_contentHandler.setDocumentLocator(m_locator);
  -                if (systemId != null)
  -                  m_locator.setSystemId(systemId);
  -                else {
  -                  try {
  -                    m_locator.setSystemId(System.getProperty("user.dir"));
  -                  }
  -                  catch (SecurityException se) {// user.dir not accessible 
from applet
  -                    m_locator.setSystemId("");
  -                  }
  -                }
  +    m_contentHandler.setDocumentLocator(m_locator);
  +    if (systemId != null)
  +        m_locator.setSystemId(systemId);
  +    else {
  +        try {
  +          // Adding dummy.xsl to the baseURI so that relative 
  +          // URI's will be resolved correctly.
  +          m_locator.setSystemId(System.getProperty("user.dir") + 
File.separator + "dummy.xsl");
  +         }
  +         catch (SecurityException se) {// user.dir not accessible from applet
  +             m_locator.setSystemId("");
  +         }
  +    }
       m_dh = dh;
     }
   
  @@ -143,7 +147,9 @@
       this.m_contentHandler = contentHandler;
       m_contentHandler.setDocumentLocator(m_locator);
       try {
  -      m_locator.setSystemId(System.getProperty("user.dir"));
  +      // Adding dummy.xsl to the baseURI so that relative 
  +      // URI's will be resolved correctly.
  +      m_locator.setSystemId(System.getProperty("user.dir") + File.separator 
+ "dummy.xsl");
       } 
       catch (SecurityException se){// user.dir not accessible from applet
         m_locator.setSystemId("");
  @@ -162,7 +168,9 @@
                   if (m_contentHandler != null)
                           m_contentHandler.setDocumentLocator(m_locator);
                   try {
  -                  m_locator.setSystemId(System.getProperty("user.dir"));
  +                  // Adding dummy.xsl to the baseURI so that relative 
  +                  // URI's will be resolved correctly.
  +                  m_locator.setSystemId(System.getProperty("user.dir") + 
File.separator + "dummy.xsl");
                   } 
                   catch (SecurityException se){// user.dir not accessible from 
applet
                     m_locator.setSystemId("");
  
  
  

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

Reply via email to