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?
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
posted 19 years ago
Then perhaps the solution shouldn't be one or the other, rather which should be used under various circumstances. That really helps. Thanks!
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop