You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Da...@lotus.com on 2001/06/25 17:20:11 UTC

File paths (was: Complete newbie in Xalan using Xalan c++!!!)

Hergert writes:
>what is wrong if i tell Xalan as an Example instead of "foo.xml" using
"d:\xyz\hdghei\foo.xml" in this example foo.xml is there yes I am sure
 ^^^

I'll borrow the answer from the Xalan-Java FAQ:
Q: Why do I get 'file not found' when I pass c:\path\filename.txt?
A: Xalan often requires legal URLs as system identifiers, not local
pathnames (this is partly due to underlying parsers requiring this).
A simple (but not always correct!) way to change a local pathname into
a URL in Java 1.1x is:
  public static String filenameToURL(String filename)
  {
    File f = new File(filename);
    String tmp = f.getAbsolutePath();
    if (File.separatorChar == '\\')
    {
      tmp = tmp.replace('\\', '/');
    }
    // Note: gives incorrect results when filename already begins with
file:///
    return "file:///" + tmp;
  }
For a slightly more detailed example, see org.apache.xml.utils.
SystemIDResolver

Learn more about the details of URL/URIs:
  ftp://ftp.isi.edu/in-notes/rfc1738.txt
  ftp://ftp.isi.edu/in-notes/rfc1808.txt
  ftp://ftp.isi.edu/in-notes/rfc2396.txt

I hope you can fill in the other details.
.................David Marston


Re: File paths (was: Complete newbie in Xalan using Xalan c++!!!)

Posted by hergert <he...@darmstadt.gmd.de>.
Ok thanks to you, I will try to fix this problem...
----- Original Message ----- 
From: <Da...@lotus.com>
To: <xa...@xml.apache.org>
Sent: Monday, June 25, 2001 5:20 PM
Subject: File paths (was: Complete newbie in Xalan using Xalan c++!!!)


> 
> Hergert writes:
> >what is wrong if i tell Xalan as an Example instead of "foo.xml" using
> "d:\xyz\hdghei\foo.xml" in this example foo.xml is there yes I am sure
>  ^^^
> 
> I'll borrow the answer from the Xalan-Java FAQ:
> Q: Why do I get 'file not found' when I pass c:\path\filename.txt?
> A: Xalan often requires legal URLs as system identifiers, not local
> pathnames (this is partly due to underlying parsers requiring this).
> A simple (but not always correct!) way to change a local pathname into
> a URL in Java 1.1x is:
>   public static String filenameToURL(String filename)
>   {
>     File f = new File(filename);
>     String tmp = f.getAbsolutePath();
>     if (File.separatorChar == '\\')
>     {
>       tmp = tmp.replace('\\', '/');
>     }
>     // Note: gives incorrect results when filename already begins with
> file:///
>     return "file:///" + tmp;
>   }
> For a slightly more detailed example, see org.apache.xml.utils.
> SystemIDResolver
> 
> Learn more about the details of URL/URIs:
>   ftp://ftp.isi.edu/in-notes/rfc1738.txt
>   ftp://ftp.isi.edu/in-notes/rfc1808.txt
>   ftp://ftp.isi.edu/in-notes/rfc2396.txt
> 
> I hope you can fill in the other details.
> .................David Marston
> 
>