Chapter 20. SAX2

The Simple API for XML (SAX) uses an event-based architecture for processing XML documents, similar to the event-based architecture employed by Swing, the Java GUI API. To use SAX, you create a class that implements one of the SAX listener interfaces (there are three of them), and register an instance of that class with a SAX parser at runtime. A SAX parser reads an XML document from a data stream sequentially, from beginning to end. As it reads the stream, the SAX parser sends events to the listener object that you registered. In other words, the parser invokes callback methods on the listener object as it encounters different parts of the XML document. For example, at the start of the XML document the parser invokes the listener's ...

Get J2EE™ 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.