XML
API
DOM
An introduction to XML APIs
- The Document Object Model (DOM) and the Simple API for XML (SAX) are older XML APIs that have been supported since JDK 1.4.
- The Streaming API for XML (StAX) is a new API that was introduced with JDK 1.6.
- When you use DOM, the entire XML document structure is read into memory. When you use SAX or StAX, you can read only the parts of the XML document that you need.
- With SAX, the programmer writes code that handles events that are fired when the XML parser reads the elements of the XML document. This is known as a push technology.
- With StAX, the programmer writes code that controls when and how the XML parser reads and writes the XML document. This is known as a pull technology.
DOM is
- Memory intensive
- Read-write
- Typically used for working with documents smaller than 10 megabytes