Customize JAXB Examples
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.
briefly describe the Basic, Customize, and
Java-to-Schema JAXB examples.
TABLE 179
Basic JAXB Examples
Example Name
Description
Demonstrates how to modify a Java content tree.
Demonstrates how to enable validation during unmarshalling.
TABLE 1710
Customize JAXB Examples
Example Name
Description
Demonstrates how to customize the default JAXB bindings by using inline
annotations in an XML schema.
Similar to the Customize Inline example, this example illustrates alternate,
more terse bindings of XML simpleType definitions to Java data types.
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