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.

Customizing JAXB Bindings<br />

524<br />

<br />

A binding declaration with the jxb namespace prefix would then take the form:<br />

<br />

<br />

<br />

<br />

.<br />

.<br />

binding declarations .<br />

.<br />

<br />

<br />

<br />

Note that in this example, the globalBindings and schemaBindings declarations are used to<br />

specify, respectively, global scope and schema scope customizations. <strong>The</strong>se customization<br />

scopes are described in more detail in “Scope, Inheritance, and Precedence” on page 516.<br />

Customize Inline Example<br />

<strong>The</strong> Customize Inline example illustrates some basic customizations made by means of inline<br />

annotations to an XML schema named po.xsd. In addition, this example implements a custom<br />

data type converter class, MyDatatypeConverter.java, which illustrates print and parse<br />

methods in the customization for handling custom data type conversions.<br />

To summarize this example:<br />

1. po.xsd is an XML schema containing inline binding customizations.<br />

2. MyDatatypeConverter.java is a <strong>Java</strong> class file that implements print and parse methods<br />

specified by customizations in po.xsd.<br />

3. Main.java is the primary class file in the Customize Inline example, which uses the<br />

schema-derived classes generated by the JAXB compiler.<br />

Building and Running the Customize Inline Example Using NetBeans<br />

IDE<br />

Follow these instructions to build and run the Customize Inline example on your Application<br />

Server instance using NetBeans IDE.<br />

1. In NetBeans IDE, select File→Open Project.<br />

2. In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/jaxb/.<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

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

Saved successfully!

Ooh no, something went wrong!