The most intelligent Java IDE
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Performance
 
RSS feed
 
New topic
Author

Parsing technique to be used for reading XML message .

Ravi Kiran V
Ranch Hand

Joined: Apr 18, 2009
Messages: 1203

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 ) .




I tried to change the world, but I couldn’t find the source code
Deepak Bala
Bartender

Joined: Feb 24, 2006
Messages: 4871

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
Messages: 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
Messages: 66

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,
ITechie
Cris Ter
Greenhorn

Joined: Aug 01, 2009
Messages: 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
Messages: 10261

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
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Performance
 
RSS feed
 
New topic
IntelliJ open source