Hi, Stephen.

[EMAIL PROTECTED] wrote on 2007-08-17 01:01:35 PM:
> And why does the base on Windows have "/" as the separator instead 
> of "\", which
> is in java.io.File.separator?
> 
> stephen wrote:
> > I am writing my own URIResolver. If I setSystemId( "/" ) on a Source 
that I
> > return, why do subsequent calls to MyURIResolver.resolve() have a base 
of
> > "file:///" instead of "/"?

The system ID that you're supplying is being converted to an absolute URI 
suitable for use in resolution of subsequent base URIs.  The "/" is a 
relative URI reference that is being resolved against some base URI, 
presumably referring to the file system, to produce the absolute URI 
"file:///" - effectively the root of the file system.  If your base URI 
had been "http://example.org/foo/bar";, resolving "/" against that would 
have yielded "http://example.org/"; - which might not have been what you 
intended a bare "/" to mean.

On Windows, the processor is taking your "\", which is not a character 
permitted in URIs, and guessing that you really intended to use "/", which 
is permitted in URIs.

The similarilty of the URI syntax to (perhaps) more familiar file system 
path syntax, makes it easier for people to understand what a URI might 
mean.  However, it also means people often end up using file system paths 
wherever URI references are expected, and the processor has to make some 
attempt to reconcile the two for usability's sake.  Sometimes that leads 
to results that surprise users.

I hope that helps.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]


Reply via email to