Previous | Next | Index | TOC | Top | Top Contents Index Glossary


Part II: Serial Access with the Simple API for XML (SAX)

Link Summary
Local Links

In this part of the tutorial, we focus on the event-driven, serial-access mechanism for accessing XML documents, SAX. This is the protocol that most servlets and network-oriented programs will want to use to transmit and receive XML documents, because it's the fastest and least memory-intensive mechanism that is currently available for dealing with XML documents.

On the other hand, the SAX protocol requires a lot more programming than the Document Object Model (DOM). It's also a bit harder to visualize, because it is an event-driven model. (You provide the callback methods, and the parser invokes them as it reads the XML data.) Finally, you can't "back up" to an earlier part of the document, or rearrange it, any more than you can back up a serial data stream or rearrange characters you have read from that stream.

For those reasons, developers who are writing a user-oriented application that displays an XML document and possibly modifies it will want to use the DOM mechanism described in the next part of the tutorial, Manipulating Document Contents with the Document Object Model.

However, even if you plan to do build DOM apps exclusively, there are several important reasons for familiarizing yourself with the SAX model:

What You'll Learn

This section of the tutorial covers the following topics:

  1. Writing a Simple XML File
  2. a) Echoing an XML File with the SAX Parser
    b) Adding Additional Event Handlers
  3. Handling Errors with the Nonvalidating Parser
  4. Substituting and Inserting Text
  5. a) Creating a Document Type Definition (DTD)
    b) DTD's Effect on the Nonvalidating Parser
    c) Defining Attributes and Entities
    d) Referencing Binary Entitites
  6. Using the Validating Parser
  7. a) Defining Parameter Entities and Conditional Sections
    b) Parsing the Parameterized DTD
  8. Using a LexicalEventListener
  9. Using the DTDHandler and EntityResolver

Previous | Next | Index | TOC | Top | Top Contents Index Glossary