Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Parsing technique to be used for reading XML message .  RSS feed

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ) .



 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use SAX or Stax

I wonder why XStream is used to persists data records

Perhaps you were looking for an ORM
 
Jamie Zhang
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Cris Ter
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anish Kuti
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your case I believe the best suited parser will be JaxMe2 . as all the data in the xml are Database data..
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!