cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: changed behaviour with source resolving
Date Wed, 01 May 2002 19:05:42 GMT
David Crossley wrote:
> This raises another issue. There seems to be confusion for the
> syntax. I see various syntaxes in the xdocs ...

That's bad. There is RFC 2396 and some predecessors about URI
syntax. Everything starting with a URI scheme identifer like
"file:" or "http:" is an absolute URI. An absolute file URL is
  file://some.host/some/path/to/file.ext
The host can be omitted, defaulting to localhost (usually the
only one you have access to anyway), so you can write
  file:///some/path/to/file.ext
Everything not starting with a protocol is a relative URI.
If it's starting with two slashes, it's a net path (no further
discussed). If starting with one slash the scheme and if
necessary the host is taken from some context and prepended.
If starting with something neither a slash or sharp "#" the
context URI is used for resolution (usually prepended after
stripping of the last path component).
Because people usually are sloppy and confuse URL and local
pathnames, many software products try to be helpful and guess
what the user actually meant. Furthermore, the concept of the
context URL is often ill defined and rarely explicitely spelled
out. The fact that Windows accept both forward and backward
slashes in pathnames from programs doesn't make it much easier.

Conclusions
If there it is plausible that the URL should be taken in the
context of the running process, which has a current working
directory (CWD), the following examples should work.
Lets say the CWD is /FOO on a Unix machine and D:\FOO on
a Windows box. (h) denotes the usual helpful guess for
stuff that's formally invalid. The colon *is* legal in Unix
pathnames.

     URL              class    resolves Unix    resolves Windows
   bar.ext           relative  /FOO/bar.ext     D:\FOO\bar.ext
   /bar.ext          relative  /bar.ext         D:\bar.ext
   C:/bar.ext        relative  /FOO/C:/bar.ext  C:\bar.ext
   /C:/bar.ext       relative  /C:/bar.ext      C:\bar.ext (h)
  file:/bar.ext      invalid   /bar.ext (h)     D:\bar.ext (h)
  file://bar.ext     invalid   /FOO/bar.ext (h) D:\FOO\bar.ext (h)
  file:///bar.ext    absolute  /bar.ext         D:\bar.ext
  file:///C:/bar.ext absolute  /C:/bar.ext      C:\bar.ext

Note that both /bar.ext and C:/bar.ext are relative URLs,
despite being absolute pathnames on their respective home
systems. Note further that the Netscape syntax which replaces
the colon after the drive letter by a pipe symbol (/C|/stuff)
is illegal, because the pipe symbol is an illegal character
at this place.

I do not claim that the above is authoritative, apply usual
disclaimer.

HTH
J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message