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 » Sat Aug 27, 2005 8:13 pm

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: 6582
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu » Mon Aug 29, 2005 8:19 am

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 » Tue Aug 30, 2005 5:44 pm

Thanks Radu! That seems to work.
Best Regards,
--
Allen Cronce

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu Sep 01, 2005 10:39 am

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 » Thu Sep 01, 2005 4:25 pm

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