Item 33. Choose DOM for Standards Support
While SAX programs are almost always faster and more memory efficient than the DOM equivalents, performance is not a god to be worshiped above all others. There are many times when using DOM makes sense. In particular, for many classes of applications, programmers will find DOM much easier to work with. If shaving off 10% of execution time or 90% of space matters less to you than saving 10% of development time, you need to consider whether DOM might better fit the problem at hand than SAX.
In particular, the following characteristics indicate that a problem might be profitably addressed by DOM.
The documents are small relative to the available memory; roughly 10% of the heap size or less.
Processing requires ...
Get Effective XML: 50 Specific Ways to Improve Your XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.