aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "extracting data from XML file using servlets" Watch "extracting data from XML file using servlets" New topic
Author

extracting data from XML file using servlets

Sri Sar
Ranch Hand

Joined: Mar 25, 2004
Posts: 44
Hi,
i have a XML file as given below:
<main>
<ele id="1">C:\My Documents\data1.txt">
<ele id="2">C:\My Documents\da2.txt">
</main>
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
Greenhorn

Joined: Jul 18, 2002
Posts: 25
Step1.
Use SAX parser for reading the path from XML file
step2.
Read files using java.io 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.


42
Balaji Loganathan
author and deputy
Bartender

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: http://aspose.com/file-tools
 
subject: extracting data from XML file using servlets
 
Similar Threads
how to use servlets/JSP/EJB ???
servlets and XML
parsing using Xerces
non recoverable error unexpected
representing as XML