/* Click here to see a list of all XML tutorials */
Q Why XML why not directly write to a Database file ?
Ans
- .XML can be written in a simple text file which not only makes it portable but also easily accessible.
- Other Databases like MS Access, SQL (though they provide a nice user friendly interface ) require to be installed before they can be used. Consider for eg I saved a file in MSAccess(.mdb) and shiffted to a Linux system which does not have support for that file so it proves useless. If instead I can use xml and store it in a plain text file,then I could view ,edit and store it.
- XML requires simple text editor , and hence can be used over all most all platforms even older OS’s
- IT is easy to decode XML data and using some common sense it can be used in any programming language to display Data.
One way of understanding XML is to view it as a Tree structure represented in text format

Consider the above diagram.
The company is the root
The company has a child nodes -Employee
Employee has child nodes -Name and Post
The company has another child nodes -Employee2
Employee2 has child nodes -Name and Post
Now we represent it in XML in a similar way
Here each node becomes an Element.
(Remeber the elements are case sensitive)
<company> <!-under this company we have…..–>
<!– for first employee–>
<employee> <!- under employee we have…..>
<name>Jack</name>
<post>Manager</post>
<employee> <!– that its for 1st employee–>
<!– for second employee–>
<employee> <!- under employee we have…..–>
<name>John</name>
<post>CEO</post>
<employee> <!– that its for 2nd employee–>
</company><!– thats it for company–>
Now that we have the basic understanding we’ll learn how to implement it.
We also have to mention the XML version we are using ,
eg. <?xml version=”1.0″ encoding=”ISO-8859-1″?>
hence we have our final XML syntax file
company.xml
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<company>
<employee>
<name>Jack</name>
<post>Manager</post>
<employee>
<company>
<employee>
<name>John</name>
<post>CEO</post>
<employee>
</company>
HopeThisHelps
Roy
/* Click here to see a list of all XML tutorials */
DidYouKnow???
What’s the farthest computer from Earth?
NASA’s Voyager satellite computes at the edge of space as we know it, which, BTW, has passed by Jupiter and Saturn – and it’s almost 30 years old.