background image

Customize JAXB Examples

<< JAXB Examples | JAXB Compiler Options >>
<< JAXB Examples | JAXB Compiler Options >>

Customize JAXB Examples

The Basic and Customize example directories contain several base files:
po.xsd
is the XML schema you will use as input to the JAXB binding compiler, and from
which schema-derived JAXB Java classes will be generated. For the Customize Inline and
Datatype Converter examples, this file contains inline binding customizations.
po.xml
is the Purchase Order XML file containing sample XML content, and is the file you
will unmarshal into a Java content tree in each example. This file is almost exactly the same
in each example, with minor content differences to highlight different JAXB concepts.
Main.java
is the main Java class for each example.
build.xml
is an Ant project file provided for your convenience. Use the Ant tool to
generate, compile, and run the schema-derived JAXB classes automatically. The build.xml
file varies across the examples.
MyDatatypeConverter.java
in the inline-customize example is a Java class used to
provide custom data type conversions.
binding.xjb
in the External Customize example is an external binding declarations file that
is passed to the JAXB binding compiler to customize the default JAXB bindings.
Table 17­9
,
Table 17­10
, and
Table 17­11
briefly describe the Basic, Customize, and
Java-to-Schema JAXB examples.
TABLE 17­9
Basic JAXB Examples
Example Name
Description
"Modify Marshal Example" on
page 511
Demonstrates how to modify a Java content tree.
"Unmarshal Validate Example"
on page 512
Demonstrates how to enable validation during unmarshalling.
TABLE 17­10
Customize JAXB Examples
Example Name
Description
"Customize Inline Example" on
page 526
Demonstrates how to customize the default JAXB bindings by using inline
annotations in an XML schema.
"Datatype Converter Example"
on page 531
Similar to the Customize Inline example, this example illustrates alternate,
more terse bindings of XML simpleType definitions to Java data types.
"External Customize Example"
on page 536
Illustrates how to use an external binding declarations file to pass binding
customizations for a read-only schema to the JAXB binding compiler.
JAXB Examples
The Java EE 5 Tutorial · September 2007
502