• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Schema prefix - xs (or) xsd

 
Shiva Samala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In the Professional XML 2nd Edition books Schema chapeter the prefix used is xsd
eg: <xsd:element name='firstName' type='xsd:string'/>

whereas in the w3schools Schema tutorial it is xs
eg: <xs:element name='firstName' type='xs:string'/>

Can someone please tell which one is correct ?

Thanks,
Shiva.
 
Serge Adzinets
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no "correct" prefix, you can use any XML string you like as a namespace prefix.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's correct. Its more of a personal preference.
I, personally prefer xsd for schema definitions.
There are too many things that start with xs (xsd, xsl, xslt ???)

- m
 
Hari Vignesh Padmanaban
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use any prefix as long as it belongs to the schema namespace

You specify the schema declaration in the schema file. This is the root elemnt of that document.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

Now the above declaration can also be

<myPrefix:schema xmlns:myPrefix="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

and then say

<myPrefix:element name='firstName' type='myPrefix:string'/>

But 'xs' or 'xsd' makes more sense than 'myPrefix'

Hope this helps

Hari
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic