Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A question about namespace definition of an XSD document, what does it 1

Status
Not open for further replies.

sarahkho

Programmer
Sep 2, 2008
1
IR
Hi
Thank you for reading my post.
Can some one please let me know whether I am correct about the following code snippet?

Code:
<xs:schema xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL]
            xmlns:shapes="[URL unfurl="true"]http://xml.tutorials.com/schema/shape"[/URL]
        xmlns="[URL unfurl="true"]http://xml.tutorials.com/schema/shape"[/URL]
        targetNamespace="[URL unfurl="true"]http://xml.tutorials.com/schema/shape">[/URL]

If we cound the link from 1 to 4 am I correct that
Line 1: define the XS namespace url to be able to use the xs prefix
Line 2: define that the XML document which will use this xsd should have shapes as its default xml namespace.
Line 3: default namespace of this document elements
line 4: I can not understand this line and why we should have both this line and line 2 and 3 or its relation with those lines


Can you please let me know which lines are manedatory and If I am mistaken with the line, what is the meaning of each line?

Thanks.
 
>Line 2: define that the XML document which will use this xsd should have shapes as its default xml namespace.
No. It simply means that, within the xsd itself (not the instance xml document), it can refer to vocabruary (names, types etc) belonging to the namespace of that uri using the prefix shapes for the purpose.

>Line 3: default namespace of this document elements
If "this" refers to the instance xml document that I feel you might be meant to refer to, then no. If the "this" refers to the present schema document, then yes.

>line 4: I can not understand this line and why we should have both this line and line 2 and 3 or its relation with those lines
Line 4 exactly means that the present schema document is meant to define the vocabruary and, if so applied for the purpose of validating, to validate the vocabruary in an instance xml document belonging the namespace with the uri so specified.
 
vocabruary" is meant for "vocabulary". Sorry!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top