In general, SAX is also much faster than the alternative, the DOM.On the other hand, because the application is not storing the data in any way, it is impossible to make changes to it using SAX, or to move backwards in the data stream.SAX was developed by the members of the XML-DEV mailing list, and the Java version is now a Source Forge project (see Related topics ).The purpose of the project was to provide a more natural means for working with XML -- in other words, one that did not involve the overhead and conceptual leap required for the DOM. The parser sends events, such as the start or end of an element, to an event handler, which processes the information.
Also, because the application is simply examining the data as it goes by, it doesn't need to store it in memory.
This tutorial examines the use of the Simple API for XML version 2.0.x, or SAX 2.0.x.
It is aimed at developers who have an understanding of XML and wish to learn this lightweight, event-based API for working with XML data.
The DOM is the traditional way of handling XML data.
With DOM, the data is loaded into memory in a tree-like structure. DOM, and by extension tree-based processing, has several advantages.
In fact, most parsers used to create DOM trees are actually using SAX to do it!