O'Reilly logo

Java and XML by Brett McLaughlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required