14.3. Using SAX

Now we'll look at using SAX to process a request for the Conference standings. The task to be performed is nearly identical to what must be done to process a request for the Division standings, but the implementation is quite different.

While DOM is based on having an in-memory representation of the entire document, and navigating around the tree, SAX is event-based, and deals with the document as it is being parsed. This has both advantages and drawbacks. One advantage is less memory use; DOM requires that the document fit in memory, and will fail if the entire document tree cannot be built in memory. However, once the DOM tree is built, you can navigate around it freely, moving back and forth, revisiting nodes, and so forth. ...

Get J2EE™ and JAX™: Developing Web Applications and Web Services 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.