Servlet to read data from XML file

admin

Administrator
Staff member
Hi,

Im new to servlets and have the basic knowledge on xml. I have a mySQL driven website which i have to change the same to an xml driven website. can someone pls help me with the start of the same. Below is the sample code of my xml file

===========package.xml===========

<?xml version="1.0" encoding="ISO-8859-1"?>
<packagelist>
<package tid="1" packageid="100050" lhpg="1" shpg="0">
<packagename>Singapore</packagename>
<packagetype>International</packagetype>
<partner>Traveljini.com Ltd</partner>
</package>

<package tid="2" packageid="100051" lhpg="0" shpg="1">
<packagename>Malaysia</packagename>
<packagetype>International</packagetype>
<partner>Traveljini.com Ltd</partner>
</package>

<package tid="3" packageid="100052" lhpg="0" shpg="0">
<packagename>Malaysia</packagename>
<packagetype>International</packagetype>
<partner>Traveljini.com Ltd</partner>
</package>

<package tid="4" packageid="100053" lhpg="1" shpg="1">
<packagename>Bangkok</packagename>
<packagetype>International</packagetype>
<partner>Traveljini.com Ltd</partner>
</package>
</packagelist>

All i need is a complete servlet code which could read any element/attribute of the xml data and display the same on the browser with some formatting.
Kindly help me with the same.

Thanks & Rgds.
Kfacets
 
Back
Top