aspose file tools
The moose likes Performance and the fly likes Parsing technique to be used for reading XML message . Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Performance
Reply Bookmark "Parsing technique to be used for reading XML message ." Watch "Parsing technique to be used for reading XML message ." New topic
Author

Parsing technique to be used for reading XML message .

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2229

Hi

i am having all my database data in the form of an XML message (A string ) .This is dynamically being constructed using Xstream API . (So XML construction is not a Problem )
This String will be about early about 80 lines .

Now i need to parse this XML file and read the values in it .

Now should i use SAX or DOM API to do this ??

(As i read that there are somewhat performance issues with each approach ) .




Save India From Corruption - Anna Hazare.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6321

Use SAX or Stax

I wonder why XStream is used to persists data records

Perhaps you were looking for an ORM


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Jamie Zhang
Greenhorn

Joined: Jul 31, 2009
Posts: 9
If you are considering DOM and SAx, you might also want to check out VTD-XML (http://vtd-xml.sf.net), which has
several distinct advantages of DOM and SAX, such as performance, memory usage and native XPath support etc..
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Hi,

You might want to take a look at this. This link will help you to identify which parser suits your need the best.

http://www.javazoom.net/services/newsletter/xmlgeneration.html

Thanks and Regards,
Suhas
http://www.xplore-java.blogspot.com/
Cris Ter
Greenhorn

Joined: Aug 01, 2009
Posts: 4
This will entirely depend on what you will be doing with the parsed xml. If you are just going to read some values from the xml document, SAX should be enough. But if you also want to edit the xml, then you need to have a DOM parser.

http://www.coderanch.com/t/122873/XML-Related-Technologies/SAX-vs-DOM-when-use
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11690
You are likely to find that the database operations are the performance limit anyway.

What do you do with the values - just generate a report?

Bill

Java Resources at www.wbrogden.com
Anish Kuti
Greenhorn

Joined: May 12, 2008
Posts: 25
In your case I believe the best suited parser will be JaxMe2 . as all the data in the xml are Database data..
 
 
subject: Parsing technique to be used for reading XML message .
 
MyEclipse, The Clear Choice