Thursday, April 24, 2008

XML - Data Structure

XML was developed as a lanuguage which could transport data accross various different platforms. It has a really robust data structures. People think XML is just another markup language like HTML but the fact of the matter is that XML is totally a different concept.
HTML is a markup language which has predefined tags and is case insensitive on the other hand XML is a case sensitive language and does not have predefined tags.


e.g.


<book category="WEB">
<title lang="en">Learning XML</title>
<author>Sankalp Shastri</author>
<year>2008</year>
<price>39.95</price>
</book>


This is an example of a well formed XML structure. Whatever name we select can be XML node, it can be your name.


XML has got a really simple mechnism of accessing it structure, and it is called XPath.


XPath
Whenever you want to access a node or its attribute, the way to do it is XPath.
e.g

/bookstore/book/title/text()


this would give us the text in the title node.


For further details you can visit the links available or can wait for my next post which would be about how the XPath can be used in different ways to access different information.

No comments: