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 because SAX handlers can ignore XML elements that are not relevant to the active task.
VA Smalltalk support for SAX specification
The VA 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.
VA Smalltalk deviations from the SAX specification
The VA Smalltalk XML SAX parser deviates from the SAX specification as follows:
•The VA Smalltalk support for SAX does not strictly adhere to the SAX-2 specification with regard to querying and setting features and properties. (See
http://www.saxproject.org). However, VA Smalltalk XML SAX parser does recognize the following Namespace features:
http://xml.org/sax/features/namespaces
http://xml.org/sax/features/namespace-prefixes
It also supports a true value for the namespaces property and a false value for the namespace-prefixes property as described in the SAX specification. (See
http://www.saxproject.org/namespaces.html for more information on Namespace support.)
Method categories for the SAX API
The AbtXmlSaxDefaultHandler class implements the following SAX interfaces:
•ContentHandler
•DTDHandler
•EntityResolver
•ErrorHandler
•LexicalHandler
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 the AbtXmlSaxDefaultHandler class along with the method category used to distinguish methods in the interface:
| |
ContentHandler | AbtSax-ContentHandler |
DTDHandler | AbtSax-DTDHandler |
EntityResolver | AbtSax-EntityResolver |
ErrorHandler | AbtSax-ErrorHandler |
LexicalHandler | AbtSax-LexicalHandler |
Other supported interfaces are:
| |
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:
| |
NamespaceSupport | AbtXmlSaxNamespaceSupport |
InputSource | AbtXmlInputSource |
Last modified date: 05/14/2020