JAXP SAX: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 10: Line 10:




To use a SAX parser, use SAXParserFactory to generate a parser instance. Then call parsers's parse() method. The parser contains a SAXReader instance, which invokes callback methods the application must implement. The methods are defined by the ContentHandler, ErrorHandler, DTDHandler and EntityResolver interfaces.
To use a SAX parser, use <tt>SAXParserFactory</tt> to generate a parser instance. The actual implementation of the parser is determined by the value of javax.xml.parsers.SAXParserFactory system property. Then call parsers's parse() method. The parser contains a <tt>SAXReader</tt> instance, which invokes callback methods the application must implement. The methods are defined by the <tt>ContentHandler</tt>, <tt>ErrorHandler</tt>, <tt>DTDHandler</tt> and <tt>EntityResolver</tt> interfaces.


For a working example of SAX parsing, see [[SAX Example]] below.
For a working example of SAX parsing, see [[SAX Example]] below.

Revision as of 20:33, 9 November 2016

External

Internal

Overview

To use a SAX parser, use SAXParserFactory to generate a parser instance. The actual implementation of the parser is determined by the value of javax.xml.parsers.SAXParserFactory system property. Then call parsers's parse() method. The parser contains a SAXReader instance, which invokes callback methods the application must implement. The methods are defined by the ContentHandler, ErrorHandler, DTDHandler and EntityResolver interfaces.

For a working example of SAX parsing, see SAX Example below.

SAX Example

SAX Example

Component Packages