JDK (Java Development Kit) Tutorials
Dr. Herong Yang, Version 5.00

SAX (Simple API for XML)

This chapter provides tutorial notes and example codes on SAX (Simple API for XML). Topics include identifying SAX implementation classes in JDK; XML content event handler interface and methods; writing your own XML parser handler using SAX interface.

SAX (Simple API for XML) Implementation in JDK

SAX Content Handler Interface

SAXBrowser.java - SAX Based XML Browser

Conclusion:

  • JDK 1.4.1 uses org.apache.crimson package as the SAX implementation.
  • JDK offers a default SAX handler org.xml.sax.helpers.DefaultHandler. It does nothing for all events.
  • The handler method characters() seems to be fired on every white space characters.

Notes and sample codes bellow are based on JDK/J2SDK 1.4.1_01.

Read my other book "Tutorial Notes on XML" on other XML related topics.

Dr. Herong Yang, updated in 2008
SAX (Simple API for XML)