Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Namespace in schema Question

 
Thread Tools Search this Thread
Old 05-21-2006, 09:57 PM   #1
Default Namespace in schema Question


Hi,

The schema tag (the root tag) of a schema file looks like

<xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
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 xmlnss="anything"
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
  Reply With Quote
Old 05-21-2006, 10:30 PM   #2
Joe Kesselman
 
Posts: n/a
Default Re: Namespace in schema Question

wrote:
> <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> 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
  Reply With Quote
Old 05-21-2006, 11:28 PM   #3
kurtrips@gmail.com
 
Posts: n/a
Default Re: Namespace in schema Question

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.

  Reply With Quote
Old 05-21-2006, 11:49 PM   #4
Joe Kesselman
 
Posts: n/a
Default Re: Namespace in schema Question

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
  Reply With Quote
Old 05-21-2006, 11:50 PM   #5
Richard Tobin
 
Posts: n/a
Default Re: Namespace in schema Question

In article <. com>,
<> wrote:

>So if this is only used as prefix, I may instead have
><xs:schema xmlnss="anything"
>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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump