background image

Customize Inline Example

<< javadoc Binding Declarations | Global Binding Declarations >>
<< javadoc Binding Declarations | Global Binding Declarations >>

Customize Inline Example

<xsd:schema xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:jxb=
"http://java.sun.com/xml/ns/jaxb"
jxb:version=
"1.0">
A binding declaration with the jxb namespace prefix would then take the form:
<xsd:annotation>
<xsd:appinfo>
<jxb:globalBindings
binding declarations />
<jxb:schemaBindings>
.
.
binding declarations
.
.
</jxb:schemaBindings>
</xsd:appinfo>
</xsd:annotation>
Note that in this example, the globalBindings and schemaBindings declarations are used to
specify, respectively, global scope and schema scope customizations. These customization
scopes are described in more detail in
"Scope, Inheritance, and Precedence" on page 518
.
Customize Inline Example
The Customize Inline example illustrates some basic customizations made by means of inline
annotations to an XML schema named po.xsd. In addition, this example implements a custom
data type converter class, MyDatatypeConverter.java, which illustrates print and parse
methods in the <javaType> customization for handling custom data type conversions.
To summarize this example:
1. po.xsd is an XML schema containing inline binding customizations.
2. MyDatatypeConverter.java is a Java class file that implements print and parse methods
specified by <javaType> customizations in po.xsd.
3. Main.java is the primary class file in the Customize Inline example, which uses the
schema-derived classes generated by the JAXB compiler.
Building and Running the Customize Inline Example Using NetBeans
IDE
Follow these instructions to build and run the Customize Inline example on your Application
Server instance using the NetBeans IDE.
1. In NetBeans IDE, select File
Open Project.
2. In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/jaxb/.
Customizing JAXB Bindings
The Java EE 5 Tutorial · September 2007
526