This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Which is really the best? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Which is really the best?" Watch "Which is really the best?" New topic
Author

Which is really the best?

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The company that I work just for started full-blown e-commerce and web development using Java, XML, and WebSphere and is now going through the process of standardizing which type of parser we should use. It seems like the developers are split over DOM and SAX. I would like to know if anyone has a recommendation as to whether DOM or SAX would be a better fit for a high-volume, enterprise development shop?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11862
You MUST analyze your requirements in detail -
1. Bulk of data - if you have tens of megabytes, SAX is your only path. This is because a DOM must be all in memory - the various element objects plus all the text data at two bytes per character - it mounts up fast.
2. Type of data usage - if you want to correlate between entries, search, or otherwise manipulate the hierarchy, SAX is going to be VERY hard to apply.
3. Frequency/volume of use - if users are going to be hitting your catalog every few seconds, it makes sense to keep it all in memory in a DOM.
4. How dynamic is the data - if you have to be able to modify entries frequently, DOM is the way to go.
5. Do you really need to store XML? I know of one application where the SQL database output goes to make a temporary XML file just so a XSL transform can be applied to make final output.
Bill

Java Resources at www.wbrogden.com
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Then perhaps the solution shouldn't be one or the other, rather which should be used under various circumstances.
That really helps. Thanks!
 
 
subject: Which is really the best?
 
Threads others viewed
Best API to update an XML document!
DOM/SAX
parser to be used
Is JDom the past?
xml parser
developer file tools