background image

JAXB Compiler Options

<< Customize JAXB Examples | XJC Binding Compiler >>
<< Customize JAXB Examples | XJC Binding Compiler >>

JAXB Compiler Options

TABLE 17­11
Java-to-Schema JAXB Examples
Example Name
Description
"Create Marshal Example" on
page 537
Illustrates how to marshal and unmarshal JAXB-annotated classes to
XML schema. The example also shows how to enable JAXP 1.3 validation
at unmarshal time using a schema file that was generated from the JAXB
mapped classes.
"XmlAccessorOrder Example" on
page 538
Illustrates how to use the @XmlAccessorOrder and @XmlType.propOrder
mapping annotations in Java classes to control the order in which XML
content is marshalled/unmarshalled by a Java type.
"XmlAdapter Field Example" on
page 540
Illustrates how to use the interface XmlAdapter and the annotation
@XmlJavaTypeAdapter
to provide a a custom mapping of XML content
into and out of a HashMap (field) that uses an int as the key and a String
as the value.
"XmlAttribute Field Example" on
page 543
Illustrates how to use the annotation @XmlAttribute to define a property
or field to be handled as an XML attribute.
"XmlRootElement Example" on
page 544
Illustrates how to use the annotation @XmlRootElement to define an XML
element name for the XML schema type of the corresponding class.
"XmlSchemaType Class Example"
on page 545
Illustrates how to use the annotation @XmlSchemaType to customize the
mapping of a property or field to an XML built-in type.
"XmlType Example" on page 546
Illustrates how to use the annotation @XmlType to map a class or enum type
to an XML schema type.
JAXB Compiler Options
The JAXB XJC schema binding compiler transforms, or binds, a source XML schema to a set of
JAXB content classes in the Java programming language. The compiler, xjc, is provided in two
flavors in the Application Server: xjc.sh (Solaris/Linux) and xjc.bat (Windows). Both xjc.sh
and xjc.bat take the same command-line options. You can display quick usage instructions by
invoking the scripts without any options, or with the -help switch. The syntax is as follows:
xjc [-options ...]
schema
The xjc command line options are as follows:
-nv
Do not perform strict validation of the input schema or schemas. By
default, xjc performs strict validation of the source schema before
processing. Note that this does not mean the binding compiler will not
perform any validation; it simply means that it will perform less-strict
validation.
JAXB Examples
Chapter 17 · Binding between XML Schema and Java Classes
503