Data Binding with JAXB
As I mentioned at the end of the last chapter, data binding is an XML processing technique that eliminates references to XML nodes from your code. Instead of working with elements and attributes, your code uses classes named Customer and PurchaseOrder. This first means that you have to define the structure of your XML documents using a schema, typically either an XML Schema or a DTD. To bind this schema to specific Java classes, which could include generating those classes from the schema, you'll use a data binding framework. These are generally composed of code-generation tools to build Java classes from a schema and a runtime library that converts an XML document into a tree of Java objects (and vice versa). There are many data binding frameworks available for Java. In this chapter, we'll look specifically at one: the Java Architecture for XML Binding ( JAXB).