Store and recall context information
- Last Updated: June 7, 2019
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
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.
ABL SAX provides a solution. Three of the AppBuilder 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 AVM creates a new temp-table record each time the SAX parser encounters the beginning of a new element
- The AVM deletes the temp-table record each time the SAX parser encounters the end of the element
The information recorded in each temp-table record includes the
parameters passed to the StartElement callback
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:
|
ABL SAX provides context management for the following SAX callbacks:
-
StartDocument -
StartElement -
EndElement