ABL SAX callbacks
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
When the XML parser encounters an XML token, ABL invokes the callback corresponding to that token—if that callback is provided by the developer. If not, the parser continues.
ABL SAX implements callbacks as internal procedures coded by
the ABL developer using signatures specified by ABL. Normally, callbacks
are placed in a procedure (.p) file that the
application runs persistently. But callbacks can also be placed
in the driver routine. A driver routine is one that calls the SAX-PARSE( ) or SAX-PARSE-FIRST( ) method.
In either case, your application assigns the containing procedure's
handle to the SAX-reader HANDLER attribute. (The HANDLER attribute
defaults to a handle to the driver routine). Then, the application
starts the parse.
StartElement, Characters, and EndElement. Within a callback, to get a handle to the SAX-reader object that
invoked the callback, use the SELF system handle.
The following fragment uses SELF within a callback
to call the SAX-reader STOP-PARSING( ) method:
|
The following fragment uses SELF within a callback
to store data in the SAX-reader PRIVATE-DATA attribute:
|
For information on the SAX parser's current location in the XML source, use the following attributes of SAX-reader:
-
LOCATOR-COLUMN-NUMBER -
LOCATOR-LINE-NUMBER -
LOCATOR-PUBLIC-ID -
LOCATOR-SYSTEM-ID
The following table summarizes the ABL SAX callbacks. For a complete description, see SAX callback reference.
| This callback . . . | Lets you . . . |
|---|---|
| ResolveEntity | Tell the parser where to find an external entity |
| StartDocument ProcessingInstruction StartPrefixMapping EndPrefixMapping StartElement Characters IgnorableWhitespace EndElement EndDocument | Process various XML tokens |
| NotationDecl UnparsedEntityDecl | Process notations and unparsed entities |
| Warning Error FatalError | Handle errors |