Click to See Complete Forum and Search --> : Servlet to read data from XML file


kfacets
05-03-2005, 08:48 AM
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

Khalid Ali
05-03-2005, 11:14 AM
I don't think asking for a complete solution is even nice. Try to write something yourself and then ask specific questions, some one may be able to find some time to help you out.