10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Contents<br />

17 Binding between XML Schema and <strong>Java</strong> Classes ......................................................................... 487<br />

JAXB Architecture ............................................................................................................................. 487<br />

Architectural Overview ............................................................................................................. 488<br />

<strong>The</strong> JAXB Binding Process ........................................................................................................ 488<br />

More about Unmarshalling ...................................................................................................... 490<br />

More about Marshalling ............................................................................................................ 490<br />

More about Validation .............................................................................................................. 490<br />

Representing XML Content ............................................................................................................. 490<br />

<strong>Java</strong> Representation of XML Schema ....................................................................................... 490<br />

Binding XML Schemas ..................................................................................................................... 491<br />

Simple Type Definitions ............................................................................................................ 491<br />

Default Data Type Bindings ..................................................................................................... 491<br />

Customizing Generated Classes and <strong>Java</strong> Program Elements ..................................................... 493<br />

Schema-to-<strong>Java</strong> .......................................................................................................................... 493<br />

<strong>Java</strong>-to-Schema .......................................................................................................................... 494<br />

JAXB Examples .................................................................................................................................. 499<br />

JAXB Compiler Options ........................................................................................................... 501<br />

JAXB Schema Generator Option ............................................................................................. 503<br />

About the Schema-to-<strong>Java</strong> Bindings ........................................................................................ 503<br />

Schema-Derived JAXB Classes ................................................................................................. 506<br />

Basic JAXB Examples ........................................................................................................................ 509<br />

Modify Marshal Example .......................................................................................................... 509<br />

Unmarshal Validate Example ................................................................................................... 510<br />

Customizing JAXB Bindings ............................................................................................................ 512<br />

Why Customize? ........................................................................................................................ 513<br />

Customization Overview .......................................................................................................... 513<br />

Customize Inline Example ........................................................................................................ 524<br />

Datatype Converter Example ................................................................................................... 529<br />

Binding Declaration Files .......................................................................................................... 531<br />

External Customize Example ................................................................................................... 534<br />

<strong>Java</strong>-to-Schema Examples ................................................................................................................ 534<br />

Create Marshal Example ........................................................................................................... 535<br />

XmlAccessorOrder Example .................................................................................................... 536<br />

XmlAdapter Field Example ...................................................................................................... 538<br />

XmlAttribute Field Example ..................................................................................................... 541<br />

XmlRootElement Example ....................................................................................................... 542<br />

15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!