What Is SAX, Anyway?
SAX is an API that can be used to parse XML documents. A parser is a program that reads data a character at a time and returns manageable pieces of data. For example, a parser for the English language might break up a document into paragraphs, words, and punctuation. In the case of XML, the important pieces of data include elements, attrib-utes, text, and so on. This is what SAX does.
SAX provides a framework for defining event listeners, or handlers. These handlers are written by developers interested in parsing documents with a known structure. The han-dlers are registered with the SAX framework in order to receive events. Events can include start of document, start of element, end of element, and so on. The handlers con-tain a number of methods that will be called in response to these events. Once the han-dlers are defined and registered, an input source can be specified and parsing can begin.