Validate fails with local file schemaLocation imports

This should cover W3C XML Schema, Relax NG and DTD related problems.
acronce
Posts: 8
Joined: Sat Aug 27, 2005 7:12 pm

Validate fails with local file schemaLocation imports

Post by acronce »

Hi all,

I'm working with a set of xsd and xml files that are checked into source control. I work from multiple machines, where the path to the files differs. The problem is that "Validate Document" fails if I specify relative paths in schemaLocation imports. Note that I'm using Oxygen 6.1 under Mac OS X 10.4.2 (Tiger).

I've posted an example for download here:

http://homepage.mac.com/WebObjects/File ... estxml.zip

If you try to perform a "Validate Document" operation on test.xml, you get an error because foo.xsd cannot include bar.xsd.

If I change foo.xsd to have an absolute path to bar.xsd, it works. But what I want is to specify a relative path so that I can move the files around without having to edit the import path.

Thanks in advance for any suggestions.
Best Regards,
--
Allen Cronce
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hi Allen,

Try removing the "file:" prefix before the relative locations in all the files like:

"http://www.test.com file:foo.xsd" => "http://www.test.com foo.xsd"
"file:bar.xsd" => "bar.xsd"

Regards, Radu.
acronce
Posts: 8
Joined: Sat Aug 27, 2005 7:12 pm

Post by acronce »

Thanks Radu! That seems to work.
Best Regards,
--
Allen Cronce
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Allen,

Just a comment: you should not specify the protocol when you write a relative location, imagine that you move your file to a webserver and access them through HTTP, then the "file" protocol will be clearly wrong in this context.

Best Regards,
George
acronce
Posts: 8
Joined: Sat Aug 27, 2005 7:12 pm

Post by acronce »

george wrote:Just a comment: you should not specify the protocol when you write a relative location, imagine that you move your file to a webserver and access them through HTTP, then the "file" protocol will be clearly wrong in this context.
Thanks for the clarification George. Originally I didn't understand that you cannot specify the protocol in a relative location.

But currently we only use relative locations for schema development. When we post our final schemas we always use full path http.

I suppose we could consider using relative partial paths for both development and our final post. Maybe that way the developmental schemas would be identical to the posted ones.
Best Regards,
--
Allen Cronce
Post Reply