Chapter 8. Advanced JDOM
Continuing with JDOM, this chapter introduces some more advanced concepts. In the last chapter, you saw how to read and write XML using JDOM, and also got a good taste of what classes are available in the JDOM distribution. In this chapter, I drill down a little deeper to see what’s going on. You’ll get to see some of the classes that JDOM uses that aren’t exposed in common operations, and you’ll start to understand how JDOM is put together. Once you’ve gotten that basic understanding down, I’ll move on to show you how JDOM can utilize factories and your own custom JDOM implementation classes, albeit in a totally different way than DOM. That will take you right into a fairly advanced example using wrappers and decorators, another pattern for adding functionality to the core set of JDOM classes without needing an interface-based API.
Helpful JDOM Internals
The first topic I cover is the architecture of JDOM. In Chapter 7, I showed you a simple UML-type model of the core JDOM classes. However, if you look closely, there are probably some things in the classes that you haven’t worked with, or didn’t expect. I’m going to cover those particular items in this section, showing how you can get down and dirty with JDOM.
Note
JDOM beta 7 was released literally days before this chapter was written. In that release, the Text
class was being whiteboarded, but had not been integrated in the JDOM internals. However, this process is happening very quickly, most likely ...
Get Java and XML, Second Edition 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.