The Sax and Dom APIs are defined by the XML-DEV group and by the W3C, respectively. The libraries that define those APIs are as follows:
Javax. xml. parsers: The JAXP APIs, which provide a common interface for different vendors 'sax and Dom parsers.
Org. W3C. Dom: DefinesDocumentClass (a DOM) as well as classes for all the components of a Dom.
Org. xml. Sax: Defines the basic sax APIs.
Javax. xml. Transform: Defines the XSLT APIs that let you transform XML into other forms.
Javax. xml. Stream: Provides Stax-specific transformation APIs.
The Simple API for XML (SAX) is the event-driven, serial-access mechanic that does element-by-Element Processing. the API for this level reads and writes XML to a data repository or the web. for server-side and high-performance applications, you will want to fully understand this level. but for every applications, a minimal understanding will suffice.
The dom api is generally an easier API to use. it provides a familiar tree structure of objects. you can use the dom api to manipulate the hierarchy of application objects it encapsulates. the dom api is ideal for interactive applications because the entire object model is present in memory, where it can be accessed and manipulated by the user.
On the other hand, constructing the DOM requires reading the entire XML structure and holding the object tree in memory, so it is much more CPU-and memory-intensive. for that reason, the sax API tends to be preferred for server-side applications and data filters that do not require an in-memory representation of the data.
The XSLT APIs defined inJavax. xml. TransformLet you write XML data to a file or convert it into other forms. as shown in the XSLT section of this tutorial, you can even use it in conjunction with the sax APIs to convert legacy data to XML.
Finally, the Stax APIs defined inJavax. xml. StreamProvide a streaming Java technology-based, event-driven, pull-parsing API for reading and writing XML documents. Stax offers a simpler programming model than Sax and more efficient memory management than Dom.
Overview of the packages JAXP