Parsing XML using SAX
The code examples in this section are written using JAXP 1.1, which supports SAX2.0.
To parse an XML document, you instantiate a javax.xml.parsers.SAXParseFactory object to obtain a SAX-based parser. This parser is then used to read the XML document a character at a time.
SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); DefaultHandler handler = new XMLParse(); saxParser.parse( new File(argv), handler );
Your SAX parser class must extend the public class org.xml.sax.helpers.DefaultHandler. This class defines stub methods that receive notification (callbacks) when XML entities are parsed. By default, these methods do nothing, but they can be overridden to do anything ...