namespace relative path trouble..

A

ax

Dear Experts,

I really worry about the following problem..

There is one XML File on my PC located at C:\Test. Hence, there are 2
XSD files on the same path
[ C:\Test ] I make an absolut reference in the XML file to the 2 XSD
files.

xmlns:address="C:\Test\file_address.xsd"
xmlns:hobby="C:\Test\file_hobby.xsd"


XML Spy Validator validates correctly the XML as long as i dont move
the files into another directory.

How can i formulate

xmlns:address="blablablabla\file_address.xsd" to look in the SAME
folder as the XML is located?
 
J

Joseph Kesselman

ax said:
xmlns:address="C:\Test\file_address.xsd"
xmlns:hobby="C:\Test\file_hobby.xsd"

Don't confuse namespace names and schema locations. A namespace is not
guaranteed to be the location of the schema, and in fact more commonly
is NOT.

And that's a broken namespace name in any case. Namespace names should
be absolute URI references; the use of relative references was
DEPRECATED after a long and painful debate which concluded that there
was no agreed-upon way to interpret them. Unless you're considering C:
to be a URI scheme -- which I doubt! -- this filename is not a URI. You
meant "file:///C:\Test\file_address.xsd", and even that is a VERY poor
choice for a namespace name since it's too likely that someone else may
use the same string. Pick a real URI based on a domain name you control,
to ensure against namespace collision.
How can i formulate
xmlns:address="blablablabla\file_address.xsd" to look in the SAME
folder as the XML is located?

Good example of why not to confuse these.

Namespace names should be absolute URI references; the use of relative
references was DEPRECATED after a long and painful debate which
concluded that there was no agreed-upon way to interpret them. But you
want a relative reference to your schema.

Divide the issue. Use a real URI for the namespace name, as discussed
above, and then provide additional direction for where to look for that
schema, typically by using the xsi:schemaLocation attribute.

http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/#schemaLocation



If XML Spy doesn't support schemalocation or some equivalentmechanism
for distinguishing between a namespace name and the schema which defines
that namespace -- if it insists that the namespace is the schema
location -- it's broken. Change tools.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,006
Messages
2,570,265
Members
46,861
Latest member
SanoraS48

Latest Threads

Top