ABL SAX callbacks
- Last Updated: July 16, 2021
- 2 minute read
- OpenEdge
- Version 13.0
- 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.
An ABL SAX application or a driver routine implements callbacks as
internal procedures or methods coded by the ABL developer using signatures specified by
ABL. An application procedure or a driver routine is the one that calls the SAX-PARSE( ) or SAX-PARSE-FIRST( ) method to start parsing the XML document.
- Callback procedures in a procedure (
.p) file, that the application runs persistently. Your application then assigns the containing procedure's callback handle to the SAX-reader'sHANDLERattribute for the SAX-Reader callback events. - Methods in a object-oriented ABL class (.cls) file. The object
instance of the class is then created by your application and sets the
SAX-Reader's
EVENT-HANDLER-OBJECTattribute to the ABL object reference as the callback handle for the SAX-Reader callback events.
StartElement, Characters, and EndElement.
|
|
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 |