1. xjc
The 'xjc' tool converts XML schema files to JAXB content classes in the Java programming language.
The following describes how to use the tool and parameters.
-
Usage
Usage: xjc [-options ...] <schema file/URL/dir/jar> ... [-b <bindinfo>] ... If dir is specified, all schema files in it will be compiled. If jar is specified, /META-INF/sun-jaxb.episode binding file will be compiled. Options: -nv : do not perform strict validation of the input schema(s) -extension : allow vendor extensions - do not strictly follow the Compatibility Rules and App E.2 from the JAXB Spec -b <file/dir> : specify external bindings files each <file> must have its own -b). If a directory is given, **/*.xjb is searched -d <dir> : generated files will go into this directory -p <pkg> : specify the target package -httpproxy <proxy> : set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost:proxyPort -httpproxyfile <f> : Works like -httpproxy but takes the argument in a file to protect password -classpath <arg> : specify where to find user class files -catalog <file> : specify catalog files to resolve external entity references support TR9401, XCatalog, and OASIS XML Catalog format. -readOnly : generated files will be in read-only mode -npa : suppress generation of package level annotations (**/package-info.java) -no-header : suppress generation of a file header with timestamp -target (2.0|2.1) : behave like XJC 2.0 and generate code that doesnt use any 2.1 features. -encoding <encoding> : specify character encoding for generated source files -enableIntrospection : enable the correct generation of Boolean getters and setters to enable Bean Introspection APIs. contentForWildcard : disable XML security features when parsing XML documents. -xmlschema : treat input as W3C XML Schema (default) -relaxng : treat input as RELAX NG (experimental,unsupported) -relaxng-compact : treat input as RELAX NG compact syntax experimental,unsupported) -dtd : treat input as XML DTD (experimental,unsupported) -wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported) -verbose : be extra verbose -quiet : suppress compiler output -help : display this help message -version : display version information -fullversion : display full version information Extensions: -Xlocator : enable source location support for generated code -Xsync-methods : generate accessor methods with the 'synchronized' keyword -mark-generated : mark the generated code as @javax.annotation.Generated -episode <FILE> : generate the episode file for separate compilation -Xpropertyaccessors : Use XmlAccessType PROPERTY instead of FIELD for generated classes
-
Parameters
Parameter Description -nv
Option to check schema validation. (true | false)
-extension
Option to execute the XJC binding compiler in extension mode.
(true | false, default value: false)
-b <file/dir>
Sets at least one external binding file.
-d <dir>
By default, the XJC binding compiler creates Java content classes in the current directory. This option specifies a different directory.
-p <pkg>
Specified target package name that overwrites any other customization.
-httpproxy <proxy>
HTTP/HTTPS proxy.
-httpproxyfile <f>
Similar to the -httpproxy parameter but uses arguments in the file to protect the password.
-classpath <arg>
Path to client application classes registered with the <jxb:javaType> and <xjc:superClass> customizations.
-catalog <file>
External catalog files for TR9401, XCatalog, and OASIS XML catalog formats.
-readOnly
Sets Java source files to 'read only' mode. (Default value: false)
-npa
Summarizes the package level annotations in package-info.java.
-no-header
Creates file headers without timestamps.
-target (2.0|2.1)
Behaves like XJC 2.0 or 2.1, and creates code that is fully 2.0 or 2.1 compatible (2.2 functions are not used).
-xmlschema
Treats input as a W3C XML schema.
Input options:
-
relaxing
-
relaxng-compact
-
dtd
-
wsdl
-
xmlschema (Default)
-relaxng
Treats input as RELAX NG.
-relaxng-compact
Treats input as simple RELAX NG.
-dtd
XML DTD file is used as the input schema of the compiler.
-wsdl
Specifies a WSDL file and compiles the schema files in the WSDL file.
-verbose
Displays verbose messages.
-quiet
Prevents compiler output messages from being displayed, such as progression information or warning messages.
-help
Displays help.
-version
Displays the compiler version.
-
-
Example
xjc is a general script file located in JEUS_HOME/bin/.
The following is an example of executing xjc.
$ xjc -d build/classes -p com.tmaxsoft src/conf/ts.xsd
The previous command creates compiled Java class files with a package name of "com.tmaxsoft" in the "build/classes" folder, from the ts.xsd schema file.