473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Namespace in schema Question

Hi,

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

<xs:schema xmlns:xs="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 xmlns:xs="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.)

May 21 '06 #1
4 1404
ku******@gmail.com wrote:
<xs:schema xmlns:xs="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
May 21 '06 #2
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.

May 21 '06 #3
In article <11*********************@j55g2000cwa.googlegroups. com>,
<ku******@gmail.com> wrote:
So if this is only used as prefix, I may instead have
<xs:schema xmlns:xs="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
May 21 '06 #4
ku******@gmail.com 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
May 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
2
by: Stanimir Stamenkov | last post by:
I'm trying to find out if it is permissible to include a schema document with absent target namespace to a schema with specified target namespace, and if it is, what are the rules to resolve the...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
1
by: Jay | last post by:
I have a Access/VBA client that exports xml to the local drive, then posts it over http to an aspx page. The aspx page consumes it, then builds itself based on the xml data. This works find only...
2
by: Ian | last post by:
I've inherited some xml that doesn't have a namespace and doesn't have a reference to the schema. The schema doesn't have a targetNamespace attribute. I'm trying to build a test tool, in C#, which...
12
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
4
by: R. Nachtsturm | last post by:
Hi, Question (in short): can i somehow use the namespace tag to define that a class in its own file is actually the subclass (namespace wise) of another class? Explanation: for example, if I...
3
by: bhu | last post by:
Hi i am trying some things in XML for webservices but got stuck with the xml Creation. This is the First Sample C# Code XmlDocument oInvDocument = new XmlDocument(); oNode=...
1
by: Arndt Jonasson | last post by:
Let's say an XML Schema schema A uses types from another schema B. Then, if I understand things correctly, A needs to import schema B (maybe "importing its namespace" is more correctly put). It is...
3
by: Markus Bauer | last post by:
Hello, I have a problem with the namespace prefix. I need to add nodes to a xml file that is not created by me. It has a namespace with the prefix "NFD". So an already existing node looks...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.