[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Relative URLs using the file scheme?

file url relative path
On Wed, Oct 16, 2002 at 09:39:36AM +1000, Eddie Robertsson wrote:
> I've run into a problem using Xerces (2.2.0) for W3C XML Schema 
> validation when it comes to specifying relative paths to the schema 
> document. Here is the scenario:

  I bet it's described as an URI-Reference, i.e. driven by RFC 2396
model to compose the base URI of the document with the URI-Reference
to get the final URI of the resource of the Schemas document.

> I have an XML document located in the following location: C:\Files\test.xml
> and the W3C XML Schema file is in the following location: 
> C:\Files\Schemas\test.xsd
> In the older versions of Xerces (pre 2.1.0) the following schema 
> locations would all work in test.xml:
> (absolute) xsi:noNamespaceSchemaLocation="C:\Files\Schemas\test.xsd"
> (relative) xsi:noNamespaceSchemaLocation="Schemas\test.xsd"
> (absolute) xsi:noNamespaceSchemaLocation="file:///C:/Files/Schemas/test.xsd"
> In the new version of Xerces (2.2.0) only the following works:
> (absolute) xsi:noNamespaceSchemaLocation="file:///C:/Files/Schemas/test.xsd"

  Then it is a conformance improvement. The two first can be read as
URI-References but the composition algorithm won't derive the final URI
you expect, / is the path separator, and keeping URI and not file paths
in the instance is a good way to stay within the allowed use by the 

> Now, the problem is that in the newer versions of Xerces you can no 
> longer specify the schema location using system dependant paths and 
> instead this location must be specified as a URL. This is fine as long 
> as the location is an absolute path but how do I specify a relative path 
> using the file URL (URI?) scheme?
> This problem was originally caught by one of our clients who had 
> previously used the following as a relative URL:
> (relative) xsi:noNamespaceSchemaLocation="file:Schemas/test.xsd"
> Apparently this relative URL works in both Xalan and Saxon but not in 
> Xerces. When reporting this to Xerces i got the following response:

  Interesting, RFC 1738 which is referenced from 2396 describes the
file scheme as:

  A file URL takes the form: 

  which would exclude 

and then allow to define a specific meaning for this use of the file scheme.

The file scheme doesn't allow relative path, but you should always be able
to express the same behaviour with a relative URI, 
should work the same way .
I'm not totally sure it's useful to define the notion of relative path
when the framework provides the notion of relative URI which works the same
but more generally (i.e. if your initial resource get accessed by another
scheme like http: , the reference will continue to work while the file:
one would suddenly break).

  Is there someone working on new revisions of the file scheme at the IETF ?
Did I simply miss a new RFC superceeding 1738 ? There is quite some confusion
around all those issues.

  In general I have been quite annoyed with this Windows path -> URI conversion
not personally but as people getting confused and trying to use paths directly
within URI-References, and submitting as bug reports the fact that my library
follows relatively strictly the set of associated specifications ...


Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@r...  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.