O'Reilly logo

Java & XML Data Binding 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

What You’ll Need

Finally, I want to let you know what packages, projects, and tools you’ll need to work through this book. I’ll address the installation and setup details of each in the chapters in which they are used, but you may want to go ahead and download these items before getting started (especially if you’re on a slow Internet connection. That way, you’re not stuck waiting on a download when you’d rather start a new chapter and example set.

Packages

First, you’ll need Sun’s JAXB. While JAXB is the least mature of the available data binding frameworks, Sun has often leveraged its Java influence to turn out what becomes the standard against which other packages are measured. Because of that, I’ll spend the first half of this book discussing the various data binding components in light of their relation to JAXB. You can download the early-access version of JAXB at http://java.sun.com/xml/jaxb/index.html. The specification, as of this writing, is currently released as Version 0.21, and the implementation is a 1.0 release. I’ll cover setting up JAXB for use with the examples in the next chapter.

Additionally, I’ll cover three other data binding implementations, all open source projects. I do this for obvious reasons: I’m an open source advocate, it’s easy for you to get, and as I’ve run into occasional bugs in writing this book, I’ve been able to fix them and save you some headaches. There are several commercial data binding applications, but I’ve yet to see anything that merits the high price tags they command (you will typically pay a low per-developer price, as well as a much higher one-time deployment fee). The open source packages have matured and serve me well in numerous production applications. You’re welcome to use commercial packages, although the examples will have to be tweaked to work within those frameworks.

The first data binding implementation I’ll cover is Enhydra Zeus in Chapter 7. I’m partial to this implementation, since I founded the project, but I will cover it and the other implementations as they relate to Sun’s JAXB. You can download Zeus from http://zeus.enhydra.org; I’ll use the latest CVS code for the examples in this book.

Following Zeus, I’ll discuss Castor, a project from Exolab, in Chapter 8. Castor holds the notable honor of being the first major open source project in the data binding space and is fairly mature. Although Castor offers data binding from SQL and LDAP, I’ll focus only on the XML portion of its data binding package. You can download Castor from http://castor.exolab.org; throughout the examples in Chapter 8, I’ll use Version 0.9.3.9, which can be downloaded from the web site.

The final open source data binding package I’ll cover is Quick, in Chapter 9. This package is a bit different from the others, as it defines a lot of semantics specific to Quick not found in JAXB, Zeus, or Castor. It also offers a solid environment for marshalling and unmarshalling objects without using class generation. You can download Quick from http://jxquick.sourceforge.net/quick3, and I’ll use Version 4.3.0 for the examples in Chapter 9.

Tools

Finally, I recommend some tools for working through this book. While I’ve remained a stalwart proponent of using tools like vi, Emacs, and notepad for writing my XML and code, I’ve found IDEs more useful since I need to work with multiple files at the same time. Personally, I use jEdit (http://www.jedit.org), which has become my editor of choice. I’d also recommend you have some sort of XML editor around. I actually don’t write my XML in these editors (they tend to be clumsy, in my opinion, but you may love them), but do use them for validation, checking well formedness, and other generic tasks. I’ve found jEdit and some of its plug-ins, as well as XMLSpy (http://www.xmlspy.com), helpful.

You’ll also need a Java Development Kit for compiling and running the examples. You can download the UDK from http://java.sun.com/j2se; be sure to get the development kit, not just the runtime environment. I use JDK 1.3.1 for all of my examples, but not any features specific to the 1.3 version of the JDK (like dynamic proxies). I do, however, use code and frameworks that require Java 1.2 or greater for the included collection support. Any other productivity tools you use are up to you. Once you’ve got everything in place, turn the page and we’ll get started.

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