Re: Relative URLs using the file scheme?
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 specifications. > 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: file://<host>/<path> which would exclude file:/<path> 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, xsi:noNamespaceSchemaLocation="Schemas/test.xsd" 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 -- 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/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format