Progress
External Program
Interfaces
SAX and the Progress ADE
You can use the Progress ADE to develop Progress SAX applications. This involves the following tasks:
To create a SAX Handler object, which corresponds to a procedure (
.p
) file to contain the SAX callbacks, follow these steps:To supply the callbacks that your SAX application requires, follow these steps:
- On the AppBuilder tool bar, click the Edit Code icon, as shown here:
![]()
The Section combo box appears.
- Change the Section combo box to Procedure. The New Procedure window appears, as shown here:
NOTE: ADE implements SAX callbacks as super procedures (which you can override) of the SAX Handler object.- Select the name of the callback desired, select Override, then click OK.
The Section Editor appears, as shown here:
NOTE: If you misspell the name of a callback, at run time, it will not be invoked. Rather, the corresponding internal procedure in the super procedure will be invoked.- Modify the callback as desired, then save it.
Storing and Recalling Context Information
The SAX specification does not say how to store and recall context information — that is, information on how XML elements are related to each other. For example, the SAX specification says that when the SAX parser encounters a new element, a startElement event should be triggered and the startElement callback should be invoked. However, the SAX specification does not say how to determine the new element’s parent.
But Progress SAX provides a solution. Three of the Progress ADE templates for SAX callbacks refer to a temp-table. The temp-table and its records can be used as a stack to record context information related to that callback. When this feature is turned on:
The information recorded in each temp-table record includes the parameters passed to startElement and the element’s path (position) in the element hierarchy. For example, in the following XML example, the path of the customer element is
/customer
and the path of the order element is/customer/orders/order
:
To activate context management (which is inactive by default), call the setContextMode() function, as demonstrated in the following code fragment:
Progress SAX provides context management for the following SAX callbacks:
Context Management Example
Here is a fragment that demonstrates the ADE context management system. The fragment retrieves the handle to the context management table, then finds the element added most recently:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |