The XJC compiler transforms, or binds, a source XML schema to a set of JAXB content classes in the Java programming language.
Invoking the xjc command without specifying any arguments outputs the usage information.
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.
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-extension switch, you will be allowed to use the JAXB Vendor Extensions.
Specify one or more external binding files to process. (Each binding file must have it's own-b 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.
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.
Specify a target package to override any binding customization for package name and the default package name algorithm defined in the specification.
Specify the HTTP/HTTPS proxy. The format is [user[:password]@]proxyHost[:proxyPort]. The old -host and -port options are still supported by the Reference Implementation for backwards compatibility, but they have been deprecated.
Specify where to find client application class files used by the <jxb:javaType> and <xjc:superClass> customizations.
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.
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.
Supress the generation of package level annotations into **/package-info.java. Using this switch causes the generated code to internalize those annotations into the other generated classes.
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.
Display compiler output, such as progress information and warnings.
Suppress compiler output.
Display a brief summary of the compiler switches.
Display the compiler version information.
Enable source location support for generated code..
Generate accessor methods with the synchronized keyword.
Mark the generated code with the -@javax.annotation.Generated annotation.
In general, it is safest to compile all related schemas as a single unit with the same binding compiler switches.
Please keep the following list of restrictions in mind when running xjc. Most of these issues only apply when compiling multiple schemas with multiple invocations of xjc.
To compile multiple schemas at the same time, keep the following precedence rules for the target Java package name in mind:
The -p command line option takes the highest precedence.
If targetNamespace is declared, apply the targetNamespace -> Java package name algorithm defined in the specification.
If notargetNamespace is declared, use a hardcoded package named "generated".
It is not legal to have more than one <jaxb:schemaBindings> per namespace, so it is impossible to have two schemas in the same target namespace compiled into different Java packages.
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.
Element substitution groups spread across multiple schema files must be compiled at the same time.
Compiles the po.xsd schema. Generated Java sources will be placed in the current directory.
xjc -p org.acme.po po.xsd
Compile the po.xsd schema. Generated Java sources will be placed in the current directory under the org.acme.po package.
xjc -d gen-src -p org.acme.po po.xsd
Compile the po.xsd schema. Generated Java sources will be placed in the gen-src directory under the org.acme.po package.
xjc po.xsdxjc -b bindings1.xjb po.xsd
Compile the "po.xsd"po.xsd schema using the binding customizations from bindings1.xjb. Generated Java sources will be placed in the current directory.
xjc -d gen-src schemadir
Compile all schema files in the schemadir directory. Generated Java sources will be placed in the gen-src directory.
You could also specify one or more schema files to compile and the XJC compiler will compile only the specified files.