<!DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD DocBook V3.0-Based SolBook Subset V2.0//EN" [
<!--ArborText, Inc., 1988-1999, v.4002-->
<!ENTITY metainfo SYSTEM "metainfo.sgm">
<!ENTITY Date "22 Dec 2004">
<!ENTITY SectDesc "User Commands">
<!ENTITY Software "J2EE SDK 1.4">
<!ENTITY arch "generic">
<!ENTITY copyright "Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved">
<!ENTITY % commonents SYSTEM "smancommon.ent">
%commonents;
<!ENTITY % booktitles SYSTEM "booktitles.ent">
%booktitles;
]>
<?Pub UDT _bookmark _target>
<?Pub Inc>
<refentry id="xjc-1m">
<refmeta><refentrytitle>xjc</refentrytitle><manvolnum>1M</manvolnum>&metainfo;
</refmeta>
<refnamediv><indexterm><primary sortas="xjc">xjc &mdash; transforms, or binds,
a source XML schema to a set of JAXB content classes in the Java programming
language</primary></indexterm><indexterm><primary sortas=" transforms, or binds, a source XML schema to a set of JAXB content classes in the Java programming language --xjc">
transforms, or binds, a source XML schema to a set of JAXB content classes
in the Java programming language &mdash; xjc</primary></indexterm><refname>
xjc</refname><refpurpose>transforms, or binds, a source XML schema to a set
of JAXB content classes in the Java programming language</refpurpose></refnamediv>
<refsynopsisdiv><title>&synp-tt;</title>
<cmdsynopsis><command>xjc </command><arg>[<replaceable> options ...</replaceable>]
</arg><arg>[<replaceable> schema file / URL / dir ... </replaceable>]</arg>
<arg>[<replaceable> -b bindinfo ... </replaceable>]</arg>
</cmdsynopsis></refsynopsisdiv>
<refsect1><title>&desc-tt;</title>
<para>The XJC compiler transforms, or binds, a source XML schema to a set
of JAXB content classes in the Java programming language.</para>
<para>Invoking the <command>xjc</command> command without specifying any arguments
outputs the usage information.</para>
</refsect1>
<refsect1><title>&opts-tt;</title>
<variablelist termlength="medium">
<varlistentry><term><option>nv </option></term><listitem><para>Disable strict
schema validation. By default, the XJC binding compiler performs strict validation
of the source schema before processing it. This does not mean that the binding
compiler will not perform any validation; it simply means that the compiler
will perform less-strict validation.</para>
</listitem></varlistentry>
<varlistentry><term><option>extension </option></term><listitem><para>By default,
the XJC binding compiler strictly enforces the rules outlined in the Compatibility
chapter of the JAXB Specification. In the default (strict) mode, you are also
limited to using only the binding customizations defined in the specification.
By using the<literal>-extension</literal> switch, you will be allowed to use
the JAXB Vendor Extensions.</para>
</listitem></varlistentry>
<varlistentry><term><option>b <replaceable>file</replaceable></option></term>
<listitem><para>Specify one or more external binding files to process. (Each
binding file must have it's own<literal>-b</literal> switch.) The syntax of
the external binding files is extremely flexible. You may have a single binding
file that contains customizations for multiple schemas or you can break the
customizations into multiple bindings files. In addition, the ordering of
the schema files and binding files on the command line does not matter.</para>
</listitem></varlistentry>
<varlistentry><term><option>d <replaceable>directory</replaceable> </option></term>
<listitem><para> Specify an alternate output directory. By default, the XJC
binding compiler will generate the Java content classes in the current directory.
The output directory must already exist; the XJC binding compiler will not
create it for you.</para>
</listitem></varlistentry>
<varlistentry><term><option>p <replaceable>package</replaceable> </option></term>
<listitem><para>Specify a target package to override any binding customization
for package name and the default package name algorithm defined in the specification.
</para>
</listitem></varlistentry>
<varlistentry><term><option>httpproxy <replaceable>proxy</replaceable> </option></term>
<listitem><para>Specify the HTTP/HTTPS proxy. The format is <literal>[user[:password]@]proxyHost[:proxyPort]
</literal>. The old <literal>-host </literal>   and <literal>-port </literal>
options are still supported by the Reference Implementation for backwards
compatibility, but they have been deprecated.</para>
</listitem></varlistentry>
<varlistentry><term><option>classpath <replaceable>arg </replaceable> </option></term>
<listitem><para>Specify where to find client application class files used
by the <literal>&lt;jxb:javaType> </literal> and <literal>&lt;xjc:superClass> 
</literal> customizations.</para>
</listitem></varlistentry>
<varlistentry><term><option>catalog <replaceable>file</replaceable> </option></term>
<listitem><para>Specify catalog files to resolve external entity references.
Supports TR9401, XCatalog, and OASIS XML Catalog format. For more information,
please read the XML Entity and URI Resolvers document or examine the catalog-resolver
sample application.</para>
</listitem></varlistentry>
<varlistentry><term><option>readOnly </option></term><listitem><para>Force
the XJC binding compiler to mark the generated Java sources read-only. By
default, the XJC binding compiler does not write-protect the Java source files
it generates. </para>
</listitem></varlistentry>
<varlistentry><term><option>npa </option></term><listitem><para>Supress the
generation of package level annotations into <literal>**/package-info.java
</literal>. Using this switch causes the generated code to internalize those
annotations into the other generated classes.</para>
</listitem></varlistentry>
<varlistentry><term><option>xmlschema </option></term><listitem><para>Treat
input schemas as W3C XML Schema (default). If you do not specify this switch,
your input schemas will be treated as W3C XML Schema.</para>
</listitem></varlistentry>
<varlistentry><term><option>verbose </option></term><listitem><para>Display
compiler output, such as progress information and warnings.</para>
</listitem></varlistentry>
<varlistentry><term><option>quiet </option></term><listitem><para>Suppress
compiler output.</para>
</listitem></varlistentry>
<varlistentry><term><option>help </option></term><listitem><para>Display a
brief summary of the compiler switches.</para>
</listitem></varlistentry>
<varlistentry><term><option>version </option></term><listitem><para>Display
the compiler version information.</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1><title>EXTENSIONS</title>
<variablelist termlength="medium">
<varlistentry><term><option>Xlocator </option></term><listitem><para>Enable
source location support for generated code..</para>
</listitem></varlistentry>
<varlistentry><term><option>Xsync-methods </option></term><listitem><para>
Generate accessor methods with the <literal>synchronized </literal>keyword.
</para>
</listitem></varlistentry>
<varlistentry><term><option>mark-generated </option></term><listitem><para>
Mark the generated code with the <literal>-@javax.annotation.Generated </literal>
annotation.</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1><title>COMPILER RESTRICTIONS</title>
<para>In general, it is safest to compile all related schemas as a single
unit with the same binding compiler switches.</para>
<para>Please keep the following list of restrictions in mind when running<command>
 xjc</command>. Most of these issues only apply when compiling multiple schemas
with multiple invocations of <command>xjc</command>.</para>
<itemizedlist>
<listitem><para>To compile multiple schemas at the same time, keep the following
precedence rules for the target Java package name in mind:</para>
<orderedlist>
<listitem><para>The <literal>-p</literal> command line option takes the highest
precedence.</para></listitem>
<listitem><para><literal>&lt;jaxb:package></literal> customization</para>
</listitem>
<listitem><para> If <literal>targetNamespace</literal> is declared, apply
the <literal>targetNamespace</literal> -> Java package name algorithm defined
in the specification.</para></listitem>
<listitem><para>If no<literal>targetNamespace</literal> is declared, use a
hardcoded package named "generated". </para></listitem>
</orderedlist>
</listitem>
<listitem><para> It is not legal to have more than one <literal>&lt;jaxb:schemaBindings>
</literal> per namespace, so it is impossible to have two schemas in the same
target namespace compiled into different Java packages.</para></listitem>
<listitem><para>All schemas being compiled into the same Java package must
be submitted to the XJC binding compiler at the same time; they cannot be
compiled independently and work as expected.</para></listitem>
<listitem><para>Element substitution groups spread across multiple schema
files must be compiled at the same time.</para></listitem>
</itemizedlist>
</refsect1>
<refsect1><title>&exam-tt;<?Pub Caret></title>
<example>
<title>Using <command>xjc</command> to compile schema and put generated Java
sources in current directory</title>
<screen>xjc po.xsd</screen>
<para>Compiles the <filename>po.xsd</filename> schema.  Generated Java sources
will be placed in the current directory.</para>
</example>
<example>
<title>Using <command>xjc</command> to compile schema and put generated Java
sources in a specified package under the current directory</title>
<screen>xjc -p org.acme.po po.xsd</screen>
<para>Compile the <filename>po.xsd</filename> schema.  Generated Java sources
will be placed in the current directory under the <filename>org.acme.po</filename>
package.</para>
</example>
<example>
<title>Using <command>xjc</command> to compile schema and put generated Java
sources in specified package under specified directory</title>
<screen>xjc -d gen-src -p org.acme.po po.xsd</screen>
<para>Compile the <filename>po.xsd</filename> schema.  Generated Java sources
will be placed in the <filename>gen-src</filename> directory under the <filename>
org.acme.po</filename> package.</para>
</example>
<example>
<title>Using <command>xjc</command> to compile schema using binding customizations
and put generated Java sources in current directory</title>
<screen>xjc po.xsdxjc -b bindings1.xjb po.xsd</screen>
<para>Compile the "po.xsd"<filename>po.xsd</filename> schema using the binding
customizations from <filename>bindings1.xjb</filename>.  Generated Java sources
will be placed in the current directory.</para>
</example>
<example>
<title>Using <command>xjc</command> to compile schema in selected directory
and put generated Java sources in specified directory</title>
<screen>xjc -d gen-src schemadir</screen>
<para>Compile all schema files in the <filename>schemadir</filename> directory.
 Generated Java sources will be placed in the <filename>gen-src</filename>
directory.</para>
<para>You could also specify one or more schema files to compile and the XJC
compiler will compile only the specified files.</para>
</example>
</refsect1>
<refsect1><title>&also-tt;</title>
<para><link linkend="schemagen-1m"><citerefentry><refentrytitle>schemagen
</refentrytitle><manvolnum>1M</manvolnum></citerefentry></link></para>
</refsect1>
</refentry>
<?Pub *0000011273>
