The moose likes Servlets and the fly likes extracting data from XML file using servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "extracting data from XML file using servlets" Watch "extracting data from XML file using servlets" New topic

extracting data from XML file using servlets

Sri Sar
Ranch Hand

Joined: Mar 25, 2004
Posts: 44
i have a XML file as given below:
<ele id="1">C:\My Documents\data1.txt">
<ele id="2">C:\My Documents\da2.txt">
the text files contains some names and a number for each name like
sam 29
chris 32 etc
i want the pseudo-code using which i can use a servlet to extract the data present in the files "data1.txt" and "da2.txt" and then perform calculations on them like multiplying the values in the text files.
thanks in advance
Basavaraju Banakar

Joined: Jul 18, 2002
Posts: 25
Use SAX parser for reading the path from XML file
Read files using package....

It is impossible to make anything foolproof because fools are so ingenious..Murphy<br />Basu.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Why use SAX when DOM is a lot easier to use?
I know SAX is a bit more memory efficient but unless you're loading megabytes of data at a time that doesn't matter and the faster coding when using DOM more than pays for itself.

Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
For me DOM working great even for xml file which is 1855kb, but I am using MSXML parser
No 100% CPU usage and very fast.

Spritle Software Blogs
I agree. Here's the link:
subject: extracting data from XML file using servlets
It's not a secret anymore!