O'Reilly logo

Java™ Web Services Unleashed by Mark Wutka, Joseph Weber, Arthur Ryman, K. Scott Morrison, Benoît Marchal, Matthias Kloppmann, Steven Haines, Darren Govoni, Francisco Curbera, Frank Cohen, Robert Brunner

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

Advanced Binding Schemas

The previous example demonstrated how easy JAXB can be to use, but in turn it hid all the details of the binding scheme. To become proficient in using JAXB, you must understand how binding schemes work and what default values are used when you do not specify them explicitly.

The sample binding scheme used previously in the chapter is as follows:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xml-java-binding-schema version="1.0ea">
    <element name="books" type="class" root="true" />
</xml-java-binding-schema>

It defines a single element, <books>, as the root element. The JAXB code generator then looks at the DTD:

 <!ELEMENT books (book*) > <!ELEMENT book (title, author, price) > <!ATTLIST book category CDATA #REQUIRED ...

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