
336 • XML & Related Technologies
7.1.3 The StAX API
Sometime back, work started to happen in the area of an API that could inherit the best features of the SAX
and the DOM. The SAX is an event-driven API, which means that it indicates to the program where the
document starts and ends, where an element or its contents start and end, what are the attribute names and
pairs, and so on. On the other hand, the DOM builds the XML document as an in-memory tree before the
program can process it. SAX is fast and memory-efficient – however, it pushes XML data to the program,
whether or not it is ready to receive it. Hence, it can be a bit of nuisance at ...