sboag       00/10/18 09:18:18

  Modified:    java/src/org/apache/xalan/utils SystemIDResolver.java
  Log:
  Fix up base to an absolute file URL if both uri and base are relative.
  
  Revision  Changes    Path
  1.8       +18 -0     
xml-xalan/java/src/org/apache/xalan/utils/SystemIDResolver.java
  
  Index: SystemIDResolver.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/utils/SystemIDResolver.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SystemIDResolver.java     2000/10/09 23:25:20     1.7
  +++ SystemIDResolver.java     2000/10/18 16:18:17     1.8
  @@ -66,6 +66,18 @@
   public class SystemIDResolver
   {  
     
  +  public static String getAbsoluteURIFromRelative(String uri)
  +  {
  +    String curdir = System.getProperty("user.dir");
  +    if(null != curdir)
  +    {
  +      uri = "file:///"+curdir+System.getProperty("file.separator")+uri;
  +    }
  +    if(null != uri  && (uri.indexOf('\\') > -1))
  +      uri = uri.replace('\\', '/');
  +    return uri;
  +  }
  +  
     /**
      * Take a SystemID string and try and turn it into a good absolute URL.
      * @exception SAXException thrown if the string can't be turned into a URL.
  @@ -73,6 +85,12 @@
     public static String getAbsoluteURI(String urlString, String base)
       throws SAXException 
     {
  +    if((urlString.indexOf(':') < 0) && (null != base) && 
  +       (base.indexOf(':') < 0))
  +    {
  +      base = getAbsoluteURIFromRelative(base);
  +    }
  +
       // bit of a hack here.  Need to talk to URI person to see if this can be 
fixed.
       if((null != base) && 
          urlString.startsWith("file:") && (urlString.charAt(5) != '/'))
  
  
  

Reply via email to