473,387 Members | 1,863 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,387 software developers and data experts.

Schema & Namespaces

I'm having tons of trouble getting my schema namespace to work. When i
point the validator at the following two examples, it gives the error:

Warning at (2,2): Could not find schema information for the element
'pleaseWork:aWidget'.

I'm trying to validate it using:
http://apps.gotdotnet.com/xmltools/x...r/default.aspx

What am I missing/not understanding? I'm familiar with namespaces
from C++, but cant seem to get this right.
instance.xml:
<?xml version="1.0" encoding="utf-8" ?>
<aWidget xmlns="pleaseWork">
<Model>3x4x1.5</Model>
</aWidget>

namespace.xsd:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="pleaseWork" xmlns="pleaseWork" >
<xs:element name="aWidget" type="Widget" />
<xs:complexType name="Widget">
<xs:all>
<xs:element name="Model" type="xs:string" />
</xs:all>
</xs:complexType>
</xs:schema>

Jun 7 '06 #1
9 1111
yes, i know they "should" be URI's but that is not required, its just
commen ( and good ) practice to use them. I removed the URI's i had
trying to reduce the problem and make it simpler. If you replace
"pleaseWork" with "http://www.google.com" in both documents it makes no
difference.
Joe Kesselman wrote:
First thing to fix: Namespace names should be absolute URIs.


Jun 7 '06 #2
First thing to fix: Namespace names should be absolute URIs.
Jun 7 '06 #3


ho*****@gmail.com wrote:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="pleaseWork" xmlns="pleaseWork" >


Remove that xmlns="pleaseWork" and add
elementFormDefault="qualified"
as an attribute to the xs:schema element.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 7 '06 #4
Using the following documents I get this error:

Type 'Widget' is not declared.

namespace.xsd:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="pleaseWork" elementFormDefault="qualified" >
<xs:element name="aWidget" type="Widget" />
<xs:complexType name="Widget">
<xs:all>
<xs:element name="Model" type="xs:string" />
</xs:all>
</xs:complexType>
</xs:schema>

instance.xml:
<?xml version="1.0" encoding="utf-8" ?>
<aWidget xmlns="pleaseWork">
<Model>3x4x1.5</Model>
</aWidget>

Jun 7 '06 #5
In article <44***********************@newsread4.arcor-online.net>,
Martin Honnen <Ma***********@gmx.de> wrote:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="pleaseWork" xmlns="pleaseWork" >
Remove that xmlns="pleaseWork"
No, it's needed for the reference to the type Widget in the element
declaration of aWidget.
and add elementFormDefault="qualified"
as an attribute to the xs:schema element.


Yes, this is the problem. The declaration of the element Model is
a local declaration, and by default it declares the element with no
namespace.

-- Richard
Jun 7 '06 #6

Joe Kesselman wrote:
First thing to fix: Namespace names should be absolute URIs.


Why? They need to be URIs, but what requires them to be absolute?

Obviously document portability suffers if they're not, but this
shouldn't affect validity within a local system (i.e. the actual
resolution of the URI remains constant within the scope of all document
instances)

Jun 8 '06 #7
Andy Dingley <di*****@codesmiths.com> wrote:
First thing to fix: Namespace names should be absolute URIs.

Why? They need to be URIs, but what requires them to be absolute?


The W3C debated this at painful length, and concluded that there were
too many conflicting views of what a relative namespace should mean, if
anything. (Think about it. The namespace asserts the semantic intent of
the document. Do you really want a document's intent to change because
you copy it from one directory to another, even on a single machine? Do
you want to deal with the fact that two URIs may resolve to the same
thing but can't be proven to do so?) The conclusion was that relative
namespace URIs should deprecated, and their behavior is explicitly
undefined, until and unless the Semantic Web folks come back to us with
a proposal that makes them meaningful ... and at that time, a lot of
code is going to have to be revisited.

Meanwhile, applications are free to reject relative namespace URIs, or
to compare them as literal strings, or to try to compare them as
resolved... in other words, the behavior is unpredicatable.

That's good and sufficient reason not to climb into this kettle of worms.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 8 '06 #8
In article <W4******************************@comcast.com>,
Joe Kesselman <ke************@comcast.net> wrote:
First thing to fix: Namespace names should be absolute URIs. Why? They need to be URIs, but what requires them to be absolute?

The W3C debated this at painful length, and concluded that there were
too many conflicting views of what a relative namespace should mean, if
anything.


They went so far as to have a ballot on the subject. The report of
the result is at

http://www.w3.org/2000/09/xppa

-- Richard
Jun 8 '06 #9
Richard Tobin wrote:
They went so far as to have a ballot on the subject.


Yeah, I know. I was there. It was rather more interesting than any of us
really wanted it to be.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 9 '06 #10

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

Similar topics

5
by: Zombie | last post by:
Hi, Can I have 2 namespaces in the same XML schema? In the schema, I wish to declare elements such that some of them belong to one namespace and others belong to a second namespace. Is this...
4
by: Ian | last post by:
I would like to set a path to a schema where both the xml file and the schema are on my local hard drive (e.g. c:\XML\auto.xml and c:\XML\auto.xsd) Thank you, Ian
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...
1
by: Ryan | last post by:
I have a very complex XDR schema that uses namespaces: xmlns="urn:schemas-microsoft-com:xml-data" xmlns:b="urn:schemas-microsoft-com:BizTalkServer" xmlns:d="urn:schemas-microsoft-com:datatypes"...
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...
2
by: PeterW | last post by:
I have an xml file from which I want to generate an xsd schema and at a later stage a cs class. The xml file has a mix of defined namespaces and also an empty namespace. These are defined as...
6
by: LesleyW | last post by:
Hi Apologies if this is a really dumb question, but being new to XML and Schemas, I wonder if giving the namespace for eg xsd or xsi as a website address means that the user has to be online...
0
by: comic_rage | last post by:
Hi, I need to use C# to print the xml schema root <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://www.ciber.com/myfile" xmlns="http://www.ciber.com/myfile"...
3
by: chuck | last post by:
Hello, What is a good editor for exploring and looking at an xml/schema file graphically, and keeps track of namespaces? Thanks. -c
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.