Chapter 8. JDOM

We are at the midpoint of our travels through XML-land, and you should be starting to form some opinions about how useful the tools we have examined are, where some are handy and some are cumbersome, how to use these APIs and concepts in your applications, and most of all, what you want XML to do for you. In this chapter, however, we stop briefly to examine additional Java and XML APIs before diving into specific XML topics. First, we take a look at a helper API, the Java API for XML Parsing ( JAXP). This API, developed by Sun, is intended to provide an abstraction layer over obtaining a SAX or DOM parser instance; as we saw in previous chapters, this is not always a standardized task (particularly when using DOM), and constitutes a serious gap in the process of using XML in a vendor-independent way.

After this look at JAXP, we introduce a new API, JDOM. Although not related to DOM in any structural or implementation manner, JDOM does provide a complete view of an XML document (as DOM does); however, it has been created for the specific purpose of solving the variety of problems that we have already discussed related to using SAX and DOM (remember all of those “Gotcha!” sections?), as well as for enhancing usability and performance of the current Java API offerings. We will discuss this API, its purpose, functionality, and future, and examine it as an alternative to using SAX, DOM, and JAXP. First, though, we need to look at what JAXP is and add it to our toolbox ...

Get Java and XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.