Try OpenEdge Now
skip to main content
Working with XML
Reading XML Documents with the Simple API for XML (SAX) : Developing ABL SAX applications : Basic tasks of OpenEdge SAX application
 

Basic tasks of OpenEdge SAX application

A typical ABL SAX application performs the following tasks:
1. Creates a SAX-reader object
2. Runs a persistent procedure that contains the SAX callbacks
3. Configures the SAX-reader object by:
a. Setting its HANDLER attribute to the handle of the routine that contains the SAX callbacks
b. Turning namespace processing and validation on or off as needed
c. Specifying the input source using the SET-INPUT-SOURCE( ) method
4. Starts the parser by calling the SAX-PARSE( ) or SAX-PARSE-FIRST( ) method
5. Handles XML data passed to the callbacks as the parser proceeds
6. Monitors the state of the parse by checking error codes and the parse status after each call to the SAX-PARSE( ), SAX-PARSE-FIRST( ), and SAX-PARSE-NEXT( ) methods
7. Releases resources, including deleting the SAX-reader object
Most of these tasks can be performed using the attributes and methods of the SAX-reader object, which are summarized in the following table.
Table 13. Tasks handled by SAX-reader attributes and methods
To perform this task . . .
Use this attribute or method . . .
Specify the XML input
SET-INPUT-SOURCE( ) method
Specify a search path for the DTD
SCHEMA-PATH attribute
Specify the location of XML Schema documents with namespace and location pairs
SCHEMA-LOCATION attribute
ADD-SCHEMA-LOCATION( ) method
Specify the location of the XML Schema used to validate XML elements that do not specify a namespace
NONAMESPACE-SCHEMA-LOCATION attribute
Tell the parser where the callbacks reside
HANDLER attribute
Toggle parser options
SUPPRESS-NAMESPACE-PROCESSING attribute
VALIDATION-ENABLED attribute
Start, continue, or stop parsing
SAX-PARSE( ) method
SAX-PARSE-FIRST( ) method
SAX-PARSE-NEXT( ) method
STOP-PARSING( ) method
Get the status of the parse
LOCATOR-COLUMN-NUMBER attribute
LOCATOR-LINE-NUMBER attribute
LOCATOR-PUBLIC-ID attribute
LOCATOR-SYSTEM-ID attribute
PARSE-STATUS attribute
Get or set information concerning this particular SAX-reader object
PRIVATE-DATA attribute