I have a doubt in XML Vocabulary.
XML schema is an alternative to the DTD’s.
XSLT is an stylesheet for XML
I am clear on the XML schema and XSLT.
But what is XML Vocabulary?
It is also simillar to an XML schema or DTD or it is a collection of well defined XML schema?
Sorry for asking this silly question i was googling for more than an hour to find what is a XML vocabulary but i haven got a clarity on the XML vocabulary.
I got something like this while browsing
Book XML vocabulary – just for marking up book data:
<Book>
<Title>The Wisdom of Crowds</Title>
<Classification>non-fiction</Classification>
<Author>James Surowiecki</Author>
</Book>
Music XML vocabulary – just for marking up music data:
<Musical-Score>
<Work>Winterreise</Work>
<Genre>classical</Genre>
<Composer>Franz Schubert</Composer>
</Musical-Song>
Here the same data is marked up, this time using a single generic XML
vocabulary:
Composition XML vocabulary – for marking up any literary data:
<Composition class="Book">
<Title>The Wisdom of Crowds</Title>
<Category>non-fiction</Category>
<Creator>James Surowiecki</Creator>
</Composition>
<Composition class="Musical-Score">
<Title>Winterreise</Title>
<Category>classical</Category>
<Creator>Franz Schubert</Creator>
</Composition>
After seeing this i am still confused why and how it is usefull?
For e.g let us say you want to represent person information. In HTML you have to use pre-defined vocabulary (as it doesn’t allow you to create your own) so you can represent a person as below
XML lets you create your own vocabulary or tags that is meaningful as shown in below example. You can even restrict the vocabulary (so that exchange and processing of information is simplified) using XSD or DTD.
Once you have created the vocabulary using XSD then you can associate it with an XML instance using xsi namespacce as shown below
A program can validate the XML instance against a XSD programatically using the api provided in a particular language. Many languages have this support. There are also tools that can generate code to parse and create xml adhering to a XSD.