The Structure of SAX 1.0

In Chapter 13, "Parsing XML with Java," you saw how to get a SAX parser object using the standard ParserFactory methods. These parser objects issue a series of method calls to objects provided by the application. These are the callbacks (or callback events ) that your handlers must support. In this chapter, you'll learn how to configure and work with that object. Briefly, you'll use it in any single thread as follows:

  1. Set up event handlers.

  2. Tell it to parse your XML text.

  3. Respond to all the callbacks during parsing.

  4. Repeat steps 1–3 until you're done.

We'll look at those handlers throughout this chapter. Figure 16.1 illustrates the flow of data through a parser and the event handlers.

Figure 16.1. XML data flows into ...

Get XML Unleashed 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.