XML

SAX: The Simple API for XML

The discussion on XML has focused on its use as a structured document format. However, XML is also often used as a format for data storage. Unlike proprietary file formats, XML documents follow consistent structural rules and can be tested not only for well-formedness but also for compliance with specific structural rules.

There are a variety of tools out there that allow you to interact with the structure of XML documents. The previous tutorial focused on one of these technologies, the W3C's Document Object Model (DOM). This tutorial tackles another such technology, known as SAX. SAX (Simple API for XML) is an API that can be used to analyze and extract data from an XML document.

In this tutorial, you'll learn

  • What SAX is and how it works
  • How to get a SAX parser for your favorite programming language
  • How to write a Java program that uses a SAX parser to process an XML file