Try OpenEdge Now
skip to main content
Working with XML
Developing with XML in OpenEdge : Developing XML-enabled ABL applications with SAX
 

Developing XML-enabled ABL applications with SAX

The Simple API for XML (SAX) is an application programming interface (API) for XML documents. It was developed by a group of programmers, and even though it is not a W3C recommendation, it is widely used industry standard.
SAX is a streaming model that processes one element at a time and provides mechanisms for you to respond to the current element before it is flushed and the parser moves on to the next element. Contrast this with the memory-resident model of DOM.
When an XML document is accessed by a SAX application, as the XML parser encounters an XML element, it parses that element and provides its information to the application immediately, through a callback procedure. The callback procedure allows you to provide custom programming on how to handle each type of information that the parser provides to your program. On the other hand, if you do not have any custom code, you do not need to provide callback procedures. The parser's default behavior is to simply read the whole document.
So, while the DOM API decomposes an XML document into a set of nodes in a hierarchical tree, the SAX API decomposes the document into a series of procedure calls. Your application must act on the information presented as it is provided to the application. SAX can only stream forward during the parse. At the conclusion of the parse, nothing is left in memory.
As an example, if you were parsing a list of address changes intended for your database, your application would need to validate and update each change as you retrieved it from the parse.
The SAX technology built into OpenEdge also allows you to write an XML document in a forward-streaming way.
* SAX advantages
* SAX limits
* ABL support
* More information