There are two major standard APIs for processing XML with Java, namely, the Simple API for XML (SAX) and the Document Object Model (DOM). In addition, there are a few of other APIs that intend to address some of the drawbacks of SAX and DOM. The following lists the major websites about this topic.
SAX: It stands for Simple API for XML. It is the gold standard of XML APIs.
SAX is the Simple API for XML, originally a Java-only API. SAX was the first widely adopted API for XML in Java, and is a “de facto” standard. The current version is SAX 2.0.1, and there are versions for several programming language environments other than Java.
Document Object Model (DOM): It is a fairly complex API that models an XML document as a tree. It is a read-write API. It can both parse existing XML documents and create new one.
The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents.
JAXP (Java API for XML Processing): It enables applications to parse and transform XML documents independent of a particular XML processing implementation. It bundles SAX and DOM together along with some factory classes.
JDOM: It is a Java-native tree-based API that intends to deal with some drawbacks of DOM.
JDOM is, quite simply, a Java representation of an XML document. JDOM provides a way to represent that document for easy and efficient reading, manipulation, and writing. It has a straightforward API, is a lightweight and fast, and is optimized for the Java programmer. It’s an alternative to DOM and SAX, although it integrates well with both DOM and SAX.
dom4j: It is a Java-native, tree-based, read-write API for processing generic XML.
dom4j is an Open Source XML framework for Java. dom4j allows you to read, write, navigate, create and modify XML documents. dom4j integrates with DOM and SAX and is seamlessly integrated with full XPath support.
XML Pull Parsing is touted as a high performance alternative to DOM for XML parsing that is easier to use than SAX. SAX is push API and enjoys wide spread adoption virtually removing any other push API in Java. This is not the case for pull parsing where many APIs were created and only recently JSR 172 StAX (Streaming API for XML) promises to provide one standard. However even if StAX will become the API for pull parsing it is important to understand choices made in API, especially dual nature of StAX API. Additionally when choosing XML processing API between tree oriented (such as DOM), streaming push (SAX) and pull (StAX) it is crucial to understand limitations of each approach and in particular trade-off between easiness of use and memory utilization/performance.
Should you konw other popular API for processing XML with Java that I do not list here, please let me know.
This entry was posted on Wednesday, March 22nd, 2006 at 12:24 AM and filed in Java Computing. Bookmark this entry. Follow the comments here with the RSS 2.0 feed. Comments are closed, but you can leave a trackback.

