• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

XML Schema prefix - xs (or) xsd

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no "correct" prefix, you can use any XML string you like as a namespace prefix.
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic