![]() |
|
|
|
#1 |
|
Hi,
The schema tag (the root tag) of a schema file looks like <xs:schema xmlns elementFormDefault="qualified"> It is mentioned on many web pages across the net that "the parser does not connect to the server and try to download the document that's found at http://www.w3.org/2001/XMLSchema. Indeed there may not be any such document". So if this is only used as prefix, I may instead have <xs:schema xmlns elementFormDefault="qualified">. But when I validate my xml with this new xsd, I get "The element 'Books' is used but not declared in the DTD/Schema." It works fine in case 1. (Books is the root element of my xml file). Is this because this URL is hardcoded somewhere in the code of the parser itself? (I am using the MSXML 3.0 parser.) kurtrips@gmail.com |
|
|
|
|
#2 |
|
Posts: n/a
|
wrote:
> <xs:schema xmlns > Is this because this URL is hardcoded somewhere in the code of the > parser itself? Namespace URIs are meaningful even though there's often no "resource" at the location they name. In this case, the specific URI being bound to the xs: prefix is the one which is explicitly reserved for use in defining schemas. If you use something else, this XML document is no longer a schema document. The whole point of namespaces is that they are named groups of names. If you change the name of the group (the namespace URI), the names are no longer part of that group. -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry |
|
|
|
#3 |
|
Posts: n/a
|
Thanks for the prompt reply.
Joe Kesselman wrote: > In this case, the specific URI being bound to > the xs: prefix is the one which is explicitly reserved for use in > defining schemas. If you use something else, this XML document is no > longer a schema document. I do think that this *explicit reservation* is declared inside the parser code. There's no other possible place. |
|
|
|
#4 |
|
Posts: n/a
|
wrote:
> I do think that this *explicit reservation* is declared inside the > parser code. There's no other possible place. Well, inside the schema processing code, which is usually but not necessarily part of the parser per se, but why quibble. The important thing is that it's declared in the schema spec. <grin/> -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry |
|
|
|
#5 |
|
Posts: n/a
|
In article <. com>,
<> wrote: >So if this is only used as prefix, I may instead have ><xs:schema xmlns >elementFormDefault="qualified">. > >But when I validate my xml with this new xsd, I get "The element >'Books' is used but not declared in the DTD/Schema." It works fine in >case 1. (Books is the root element of my xml file). >Is this because this URL is hardcoded somewhere in the code of the >parser itself? Yes. That's how it distinguishes schema declarations from other things, by their being in the namespace http://www.w3.org/2001/XMLSchema. With your modified declaration, <xs:element name="Books"> is no longer a schema declaration at all, so any <Books> elements are undeclared. -- Richard |
|