Event-Driven Parsing: The SAX Parser

The SAX parser provides a fast, streamlined approach to parsing XML documents. While some feel that SAX is the more complex approach to parsing documents, depending on the requirements of the application, it may in fact represent an easier and faster approach than using a DOM parser.

When the SAX parser is used, the XML document is parsed as a serial stream of content. As the content of the document is scanned, events are triggered. It is the job of the event handlers to either preserve or ignore the content being scanned by the parsers. The more common classes or interfaces used by a SAX parser application are as follows (see Table 15-4).

A complete implementation of the SAX parsing classes and interfaces ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software 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.