When to Use SAX


In general, SAX processing is faster than DOM, because it does not keep track of or build in memory trees of the document, thus consuming less memory, and does not look ahead in the document to resolve node references. Since access is sequential, it is well suited to applications interested in reading XML data and applications that do not need to manipulate the data, such as applications that read data for rendering and applications that read configuration data defined in XML. However if the primary motivation is to read the data so as to subsequently process it as Java objects, JAXB is a better choice. This is covered in Chapter 13.

Applications that need to filter XML data by adding, removing, or modifying specific elements in the data are also well suited for SAX access. The XML can be read serially and the specific element modified.




Java Web Services Architecture
Java Web Services Architecture (The Morgan Kaufmann Series in Data Management Systems)
ISBN: 1558609008
EAN: 2147483647
Year: 2005
Pages: 210

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net