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.

JAXB Examples<br />

TABLE 17–8 JAXB Annotations Associated with Adapters (Continued)<br />

Annotation Description and Default Setting<br />

@Xml<strong>Java</strong>TypeAdapters A container annotation for defining multiple @Xml<strong>Java</strong>TypeAdapter<br />

annotations at the package level. Default Settings:<br />

None<br />

<strong>The</strong> sections that follow provide instructions for using the example <strong>Java</strong> applications that are<br />

included in the tut-install/javaeetutorial5/examples/jaxb/ directory. <strong>The</strong>se examples<br />

demonstrate and build upon key JAXB features and concepts. Follow these procedures in the<br />

order presented.<br />

After reading this section, you should feel comfortable enough with JAXB that you can:<br />

■ Generate JAXB <strong>Java</strong> classes from an XML schema<br />

■ Use schema-derived JAXB classes to unmarshal and marshal XML content in a <strong>Java</strong><br />

application<br />

■ Create a <strong>Java</strong> content tree from scratch using schema-derived JAXB classes<br />

■ Validate XML content during unmarshalling and at runtime<br />

■ Customize JAXB schema-to-<strong>Java</strong> bindings<br />

This chapter describes three sets of examples:<br />

JAXB Examples<br />

■ <strong>The</strong> Basic examples (Modify Marshal, Unmarshal Validate) demonstrate basic JAXB<br />

concepts like unmarshalling, marshalling, and validating XML content using default<br />

settings and bindings.<br />

■ <strong>The</strong> Customize examples (Customize Inline, Datatype Converter, External Customize)<br />

demonstrate various ways of customizing the default binding of XML schemas to <strong>Java</strong><br />

objects.<br />

■ <strong>The</strong> <strong>Java</strong>-to-Schema examples show how to use annotations to map <strong>Java</strong> classes to XML<br />

schema.<br />

Note – <strong>The</strong> Basic and Customize examples are based on a Purchase Order scenario. Each uses<br />

an XML document, po.xml, written against an XML schema, po.xsd. <strong>The</strong>se documents are<br />

derived from the W3C XML Schema Part 0: Primer (http://www.w3.org/TR/<br />

xmlschema-0/), edited by David C. Fallside.<br />

Chapter 17 • Binding between XML Schema and <strong>Java</strong> Classes 499

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

Saved successfully!

Ooh no, something went wrong!