Schema Question from a newbie...

R

Ralph Krausse

Ok so I am learning xml and schema's. argh.....

In this schema, this line...
xmlns:xs="http://www.w3.org/2001/XMLSchema"
say that the elements and data types declared with the xs prefix come
from http://www.w3.org/2001/XMLSchema. But that is url and I can go to
it. I see nothing that says anything about elements and data types. I
know the w3.org creates the standards for this type of stuff but
where?

In this line:
targetNamespace="urn:xmlns:25hoursaday-com:my-bookshelf"
defines the targetNamespage as urn:xmlns:25hoursaday-com:my-bookshelf.
What does 'urn:xmlns:25hoursaday-com:my-bookshelf' mean? Is this just
arbitrary text?
Could it be anything?

In this line"
xmlns:bk="urn:xmlns:25hoursaday-com:my-bookshelf"
say that the elements and data types declared with the bk prefix come
from urn:xmlns:25hoursaday-com:my-bookshelf. What is
'urn:xmlns:25hoursaday-com:my-bookshelf'. I know it was defined by
targetNamespace but what does that reslove to?

Where or what is 'urn:xmlns:25hoursaday-com:my-bookshelf'


*****************************************************************

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:xmlns:25hoursaday-com:my-bookshelf"
xmlns:bk="urn:xmlns:25hoursaday-com:my-bookshelf"
elementFormDefault="qualified">
<xs:element name="books">
<xs:complexType>
<xs:sequence>
<xs:element name="book" type="bk:bookType" maxOccurs="unbounded"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="bookType">
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="author" type="xs:string" />
<xs:element name="publication-date" type="xs:date" />
</xs:sequence>
<xs:attribute name="publisher" type="xs:string" />
<xs:attribute name="on-loan" type="xs:string" />
</xs:complexType>
</xs:schema>

*********************************************************************

thanks

Ralph Krausse
www.consiliumsoft.com
Use the START button? Then you need CSFastRunII...
A new kind of application launcher integrated in the taskbar!
ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg
 
P

Patrick TJ McPhee

% In this schema, this line...
% xmlns:xs="http://www.w3.org/2001/XMLSchema"
% say that the elements and data types declared with the xs prefix come
% from http://www.w3.org/2001/XMLSchema. But that is url and I can go to
% it. I see nothing that says anything about elements and data types. I
% know the w3.org creates the standards for this type of stuff but
% where?

First thing: the URI used in a namespace doesn't have to refer to
a real-world resource. In some cases, people will put content there,
but you shouldn't expect it.

Second thing: this particular URI has a link to part 1 of the
specification on it. A Google search is probably a better starting
point, but if you want the definitive description, it's right there.

% In this line:
% targetNamespace="urn:xmlns:25hoursaday-com:my-bookshelf"
% defines the targetNamespage as urn:xmlns:25hoursaday-com:my-bookshelf.
% What does 'urn:xmlns:25hoursaday-com:my-bookshelf' mean? Is this just
% arbitrary text?
% Could it be anything?

On a technical level, the name space URI is just a string with some
syntax requirements. The point is to provide a globally unique name
which sets that particular name space aside from all others. For this to
work, you need some way of keeping other people from using the same name
space as you. Internet addresses are convenient for this purpose, since
the domain registry ensures different organisations will not have
conflicting domain names, so if everybody uses addresses within their
own registered domains, there will be no conflicts.

Strictly speaking, I believe that URIs with the urn: protocol are also
supposed to be registered with some organisation. People do what they
like, though.
 

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

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top