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 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
posted
0
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