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 organized mostly 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 of the information you want when you want it. Most of the time it's necessary 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.

Processing XML with Java. A Guide to SAX, DOM, JDOM, JAXP, and TrAX
Processing XML with Javaв„ў: A Guide to SAX, DOM, JDOM, JAXP, and TrAX
ISBN: 0201771861
EAN: 2147483647
Year: 2001
Pages: 191 © 2008-2017.
If you may any questions please contact us: