SAX, the Simple API for XML, is a Java native, parser independent, event-based API for processing XML documents, suitable for use with very large documents and streaming data. SAX is mostly organized around interfaces. The implementation classes vary from one parser to the next.
The two key SAX interfaces are XMLReader, which represents the parser, and ContentHandler, through which the parser communicates with the client application. The client application registers its specific instance of the ContentHandler interface with an XMLReader through the setContentHandler() method. Then, as the XMLReader parses documents, it calls back to the methods in the ContentHandler object.
Only in the simplest programs do these callback methods give you all the information you want when you want it. Most of the time you have to gradually fill one or more data structures as the document is parsed. The complexity of any SAX program is largely a function of the complexity of the data structures you need to build.
Copyright 2001, 2002 Elliotte Rusty Harold | elharo@metalab.unc.edu | Last Modified October 15, 2001 |
Up To Cafe con Leche |