Hitachi

Hitachi Application Server V10 Command Reference Guide (For Windows® Systems)


2.2.10 xjc

xml to java compiler

Synopsis

xjc [OPTION]... <schema file/URL/dir/jar> [-b <binding>...]

    OPTION:
    [-nv]
    [-extension]
    [-d dir]
    [-p pkg]
    [-httpproxy proxy]
    [-httpproxyfile file]
    [-classpath arg]
    [-catalog file]
    [-readOnly]
    [-npa]
    [-no-header]
    [-target 2.0|2.1]
    [-encoding encoding]
    [-enableIntrospection]
    [-disableXmlSecurity]
    [-contentForWildcard]
    [-xmlschema]
    [-verbose]
    [-quiet]
    [-help]
    [-version]
    [-Xinject-code]
    [-Xlocator]
    [-Xsync-methods]
    [-mark-generated]
    [-episode file]
    [-Xpropertyaccessors]

Storage location

Application Server installation directory/javaee/glassfish/bin

Function

The XJC command produces a set of packages containing Java source files and also jaxb.properties files, depending on the binding options you used for compilation.

When generated, jaxb.properties files must be kept with the compiled source code and made available at runtime for the client applications.

Files

Arguments

-nv

Indicates whether to disable strict schema validation. This means that the command will perform less-strict validation.

-extension

Allows vendor extensions. Do not strictly follow the Compatibility Rules and App E.2 from the JAXB Spec.

-d dir

Generates the Java content classes in an alternate output directory.

For this option, the output directory must already exist since the XJC binding compiler will not create it.

Type: String

The following values can be specified:

  • Name of the output directory

Default value: N/A

-p pkg

Specifies a target package via this command-line option to override any binding customization for the package name and the default package name algorithm defined in the specification.

Type: String

The following values can be specified:

  • Target package name

-httpproxy proxy

Specifies the HTTP/HTTPS proxy.

The format is:

[user[:password]@]proxyHost[:proxyPort]

Type: Integer

The following values can be specified:

  • Specify HTTP/HTTPS proxy

Default value: N/A

-httpproxyfile file

Specifies the HTTP/HTTPS proxy, but it takes the <proxy> parameter in a file, so that you can protect the password.

The format is:

[user[:password]@]proxyHost[:proxyPort]

Type: String

The following values can be specified:

  • Filename with path

Default value: N/A

-classpath arg

Specifies where to find the client application class files used by the <jxb:javaType> and <xjc:superClass> customizations.

Type: String

The following values can be specified:

  • Classpath

Default value: N/A

-catalog file

Specifies the catalog files to resolve external entity references. Supports TR9401, XCatalog, and OASIS XML Catalog formats.

Type: String

The following values can be specified:

  • Path to the catalog file

Default value: N/A

-readOnly

Forces the XJC binding compiler to mark the generated Java sources as read-only.

-npa

Suppresses 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.

-no-header

Suppresses the generation of a file header comment that includes some note and timestamp.

Using this makes the generated code more diff-friendly.

-target 2.0|2.1

Avoids generating code that relies on any JAXB 2.1|2.2 features, thereby allowing the generated code to run with JAXB 2.0 runtime (such as JavaSE 6).

Type: Integer

The following values can be specified:

  • JAXB version number

Default value: N/A

-encoding encoding

Specifies character encoding for the generated source files.

Type: String

The following values can be specified:

  • All the jdk supported Encoding formats

Default value: platform default encoding is used

-enableIntrospection

Enables correct generation of Boolean getters/setters to enable Introspection API.

-disableXmlSecurity

Disables the XML security features when parsing XML documents.

-contentForWildcard

Generates content property for types with multiple xs:any derived elements.

-xmlschema

Treats input schemas as W3C XML Schema (default). If you do not specify this switch, your input schemas will be treated as W3C XML Schema.

Default value: W3C XML Schema

-verbose

Prints informational messages or displays stack traces when some errors occur. This information can be an extra verbose.

-quiet

Suppresses the compiler output, such as progress information and warnings.

-help

Displays a brief summary of the compiler switches.

-version

Displays the compiler version information.

-Xinject-code

Injects the specified Java code fragments into the generated code.

-Xlocator

Causes the generated code to expose SAX Locator information about the source XML in the Java bean instances after unmarshalling.

-Xsync-methods

Causes all the generated method signatures to include the synchronized keyword.

-mark-generated

Causes all the generated code to have the @Generated [http://java.sun.com/javaee/5/docs/api/jaxb-2-0-overview? javax/annotation/Generated.html] annotation.

-episode file

Generates an episode file from this compilation, so that, other schemas that rely on this schema can be compiled later and rely on classes that are generated from this compilation. The generated episode file is just a JAXB customization file (includes vendor extensions).

Type: String

The following values can be specified:

  • Name of the episode file to be created

Default value: N/A

-Xpropertyaccessors

Annotates the @XmlAccessorType of generated classes with XmlAccessType PROPERTY instead of FIELD.

schema file/URL/dir

Specifies one or more schema files to compile. If you specify a directory, then xjc will scan it for all the schema files and compile them.

Type: String

The following values can be specified:

  • Path of schema files/directory

Default value: N/A

-b binding

Specifies one or more external binding files to process.

Each binding file must have its own -b switch.

You may have a single binding file that contains customizations for multiple schemas or you can break the customizations into multiple binding files.

In addition, the ordering of the schema files and binding files on the command line does not matter.

Type: String

The following values can be specified:

  • Name of the binding file

Default value: N/A

Examples

Example1:

xjc schema1.xsd schema2.xsd schema3.xsd -b bindings123.xjb

Example2:

xjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b bindings2.xjb
-b bindings3.xjb

Exit Status

Exit Status

Explanation

0

subcommand executed successfully

1

error in executing the subcommand