JAXB

Binding Java-to-XML

JAXB 2.0, JSR 222, includes a number of important improvements to JAXB 1.0. One of these is:

  • Support for binding Java-to-XML, with the addition of the javax.xml.bind.annotation package to control this binding. JAXB 1.0 specified the mapping of XML Schema-to-Java, but not Java-to-XML Schema.

Sample

sample-jaxb-java-to-xml

Note:

  • Compiles and runs as it on Java 1.6.

  • The sample shows how to do Java-to-XML mapping (not XML Schema-to-Java).

  • Copy of the code from Sun, Enterprise Java Technologies Tech Tips for January 28, 2006, What’s New In Jaxb 2.0.