User's Guide

Simple API for XML (SAX) parser interface

The Simple API for XML (SAX) can be used to process an XML file. SAX is a standard interface for event-based XML parsing. The SAX parser "walks" the tree of document nodes in an XML file, calling the methods of user-defined handler classes when different XML strings are recognized.

When to use the SAX parser

An event-based parser, such as SAX, provides simpler, lower-level access to an XML document. Implement a SAX parser when you want to parse an XML file and execute particular actions whenever certain structures appear in the input. You can construct your own data structures using your callback event handlers. You can also parse documents that are much larger than your available system memory.

VisualAge Smalltalk support for SAX specification

The VisualAge Smalltalk XML SAX-2 support is an event-based API used to parse XML and trigger events based upon the XML input. Users can construct applications containing SAX-2 event handlers to deal with the different events that occur while parsing the XML document.

VisualAge Smalltalk deviations from the SAX specification

The VisualAge Smalltalk XML SAX parser deviates from the SAX specification as follows:

Method categories for the SAX API

The AbtXmlSaxDefaultHandler class implements the following SAX interfaces:

To override parser behavior, users can create subclasses of the AbtXmlSaxDefaultHandler class. For example, the AbtXmlSaxDOMHandler class overrides various interfaces from AbtXmlSaxDefaultHandler to construct a hierarchical document object model (DOM). Methods for each of the various SAX-2 interfaces are separated using Smalltalk method categories.

The following table lists each of the supported SAX-2 interfaces from AbtXmlSaxDefaultHandler class along with the method category used to distinguish methods in the interface:

Interface Smalltalk Category
ContentHandler AbtSax-ContentHandler
DTDHandler AbtSax-DTDHandler
EntityResolver AbtSax-EntityResolver
ErrorHandler AbtSax-ErrorHandler
LexicalHandler AbtSax-LexicalHandler

Other supported interfaces are:

Interface Smalltalk Category
Locator class=AbtXmlSaxLocator category=AbtSax-Locator
Attributes class=AbtXmlSaxAttributes category=AbtSax-Attributes
XML-Reader class=AbtXmlSaxParser category=AbtSax-XMLReader

The following SAX-2 classes do not have corresponding interfaces:

Interface Smalltalk Category
NamespaceSupport AbtXmlSaxNamespaceSupport
InputSource AbtXmlInputSource


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]