O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing a SAX Parser

Two modes are supported for XML parsing in Xerces. You can use SAX or DOM. SAX implements event-driven parsing. DOM loads the entire XML document into memory and hands you a pointer to an object hierarchy that represents it.

You'll write a SAX parser first. To parse this XML file, you need to write a class that extends the org.xml.sax.helpers.DefaultHandler class. This class provides a default set of handlers that are called whenever an event occurs during the parsing of the file. Events include finding the start of the document, encountering a start or end element tag, or reading character data.

You can leave most of these event handlers as is because they implement functionality that you don't need to parse a simple data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required