Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

XML Schema prefix - xs (or) xsd

 
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.
 
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.
 
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
 
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
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic