1xjc(1)                      General Commands Manual                     xjc(1)
2
3
4

Name

6       xjc - Java(TM) Architecture for XML Binding
7       Binding Compiler
8
9       Specification Version: 2.1
10       Reference Implementation (RI) Version: 2.1.3
11

Launching xjc

13       The  binding  compiler  can be launched using the appropriate xjc shell
14       script in the bin directory for your platform. We also provide  an  Ant
15       task to run the binding complier - see the instructions for using the
16       XJC Ant task @
17       https://jaxb.dev.java.net/nonav/2.1.3/docs/xjcTask.html.
18
19       % xjc -help
20
21   Output
22       Usage: xjc [-options ...] <schema file/URL/dir/jar> ... [-b <bindinfo>] ...
23       If dir is specified, all schema files in it will be compiled.
24       If jar is specified, /META-INF/sun-jaxb.episode binding file will be compiled.
25       Options:
26         -nv                :  do not perform strict validation of the input schema(s)
27         -extension         :  allow vendor extensions - do not strictly follow the Compatibility Rules and App E.2 from the JAXB Spec
28         -b <file/dir>      :  specify external bindings files (each <file> must have its own -b); if a directory is given, **/*.xjb is searched
29         -d <dir>           :  generated files will go into this directory
30         -p <pkg>           :  specifies the target package
31         -httpproxy <proxy> :  set HTTP/HTTPS proxy; format is [user[:password]@]proxyHost:proxyPort
32         -httpproxyfile <f> :  works like -httpproxy but takes the argument in a file to protect password
33         -classpath <arg>   :  specify where to find user class files
34         -catalog <file>    :  specify catalog files to resolve external entity references; support TR9401, XCatalog, and OASIS XML Catalog format
35         -readOnly          :  generated files will be in read-only mode
36         -npa               :  suppress generation of package level annotations (**/package-info.java)
37         -no-header         :  suppress generation of a file header with timestamp
38         -target 2.0        :  behave like XJC 2.0 and generate code that doesnt use any 2.1 features
39         -xmlschema         :  treat input as W3C XML Schema (default)
40         -relaxng           :  treat input as RELAX NG (experimental,unsupported)
41         -relaxng-compact   :  treat input as RELAX NG compact syntax (experimental,unsupported)
42         -dtd               :  treat input as XML DTD (experimental,unsupported)
43         -wsdl              :  treat input as WSDL and compile schemas inside it (experimental,unsupported)
44         -verbose           :  be extra verbose
45         -quiet             :  suppress compiler output
46         -help              :  display this help message
47         -version           :  display version information
48
49
50       Extensions:
51         -Xlocator          :  enable source location support for generated code
52         -Xsync-methods     :  generate accessor methods with the 'synchronized' keyword
53         -mark-generated    :  mark the generated code as @javax.annotation.Generated
54         -episode <FILE>    :  generate the episode file for separate compilation
55
56

OPTIONS

58          -nv
59             By default, the XJC binding compiler performs strict validation
60             of the source schema before processing it. Use this option to
61             disable strict schema validation. This does not mean that the
62             binding compiler will not perform any validation, it simply means
63             that it will perform less-strict validation.
64
65          -extension
66             By default, the XJC binding compiler strictly enforces the rules
67             outlined in the Compatibility chapter of the JAXB Specification.
68             Appendix E.2 defines a set of W3C XML Schema features that are
69             not completely supported by JAXB v1.0. In some cases, you may be
70             allowed to use them in the "-extension" mode enabled by this
71             switch. In the default (strict) mode, you are also limited to
72             using only the binding customizations defined in the specifica‐
73             tion. By using the "-extension" switch, you will be allowed to
74             use the JAXB Vendor Extensions
75
76          -b <file>
77             Specify one or more external binding files to process. (Each
78             binding file must have its own "-b" switch.) The syntax of the
79             external binding files is extremely flexible. You may have a sin‐
80             gle binding file that contains customizations for multiple
81             schemas or you can break the customizations into multiple bind‐
82             ings files: xjc schema1.xsd schema2.xsd schema3.xsd -b bind‐
83             ings123.xjb
84             xjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b bind‐
85             ings2.xjb -b bindings3.xjb In addition, the ordering of the
86             schema files and binding files on the command line does not mat‐
87             ter.
88
89          -d <dir>
90             By default, the XJC binding compiler will generate the Java con‐
91             tent classes in the current directory. Use this option to specify
92             an alternate output directory. The output directory must already
93             exist, the XJC binding compiler will not create it for you.
94
95          -p <pkg>
96             Specifying a target package via this command-line option over‐
97             rides any binding customization for package name and the default
98             package name algorithm defined in the specification.
99
100          -httpproxy <proxy>
101             Specify the HTTP/HTTPS proxy. The format is [user[:pass‐
102             word]@]proxyHost[:proxyPort]. The old -host and -port are still
103             supported by the RI for backwards compatibility, but they have
104             been deprecated. Note that the password specified with this
105             option is an argument that is visible to other users who use the
106             top command, for example. For greater security, use -httpproxy‐
107             file, below.
108
109          -httpproxyfile <file>
110             Specify the HTTP/HTTPS proxy using a file. Same format as above,
111             but the password specified in the file is not visible to other
112             users.
113
114          -classpath <arg>
115             Specify where to find client application class files used by the
116             <jxb:javaType> and <xjc:superClass> customizations.
117
118          -catalog <file>
119             Specify catalog files to resolve external entity references. Sup‐
120             ports TR9401, XCatalog, and OASIS XML Catalog format. Please read
121             the XML Entity and URI Resolvers document or the catalog-resolver
122             sample application.
123
124          -readOnly
125             By default, the XJC binding compiler does not write-protect the
126             Java source files it generates. Use this option to force the XJC
127             binding compiler to mark the generated Java sources read-only.
128
129          -npa
130             Supress the generation of package level annotations into **/pack‐
131             age-info.java. Using this switch causes the generated code to
132             internalize those annotations into the other generated classes.
133
134          -no-header
135             Supress the generation of a file header comment that includes
136             some note and timestamp. Using this makes the generated code more
137             diff-friendly.
138
139          -target 2.0
140             Avoid generating code that relies on any JAXB 2.1 features. This
141             will allow the generated code to run with JAXB 2.0 runtime (such
142             as JavaSE 6.)
143
144          -xmlschema
145             Treat input schemas as W3C XML Schema (default). If you do not
146             specify this switch, your input schemas will be treated as W3C
147             XML Schema.
148
149          -relaxng
150             Treat input schemas as RELAX NG (experimental, unsupported). Sup‐
151             port for RELAX NG schemas is provided as a JAXB Vendor Extension.
152
153          -relaxng-compact
154             Treat input schemas as RELAX NG compact syntax(experimental,
155             unsupported). Support for RELAX NG schemas is provided as a JAXB
156             Vendor Extension.
157
158          -dtd
159             Treat input schemas as XML DTD (experimental, unsupported). Sup‐
160             port for RELAX NG schemas is provided as a JAXB Vendor Extension.
161
162          -wsdl
163             Treat input as WSDL and compile schemas inside it (experimen‐
164             tal,unsupported).
165
166          -quiet
167             Suppress compiler output, such as progress information and warn‐
168             ings.
169
170          -verbose
171             Be extra verbose, such as printing informational messages or dis‐
172             playing stack traces upon some errors.
173
174          -help
175             Display a brief summary of the compiler switches.
176
177          -version
178             Display the compiler version information.
179
180          <schema file/URL/dir>
181             Specify one or more schema files to compile. If you specify a
182             directory, then xjc will scan it for all schema files and compile
183             them.
184
185
186   Non-Standard Command Line Options
187          -Xlocator
188             Causes the generated code to expose SAX Locator information about
189             the source XML in the Java bean instances after unmarshalling.
190
191          -Xsync-methods
192             Causes all of the generated method signatures to include the syn‐
193             chronized keyword.
194
195          -mark-generated
196             Mark the generated code with the annotation @javax.annota‐
197             tion.Generated.
198
199          -episode <file>
200             Generate the specified episode file for separate compilation.
201
202
203   Deprecated and Removed Command Line Options
204          -host & -port
205             These options have been deprecated and replaced with the -http‐
206             proxy option. For backwards compatibility, we will continue to
207             support these options, but they will no longer be documented and
208             may be removed from future releases.
209
210          -use-runtime
211             Since the JAXB 2.0 specification has defined a portable runtime,
212             it is no longer necessary for the JAXB RI to generate
213             **/impl/runtime packages. Therefore, this switch is obsolete and
214             has been removed.
215
216          -source
217             The -source compatibility switch was introduced in the first JAXB
218             2.0 Early Access release. We have decided to remove this switch
219             from future releases of JAXB 2.0. If you need to generate 1.0.x
220             code, please use an installation of the 1.0.x codebase.
221
222
223   Compiler Restrictions
224       In general, it is safest to compile all related schemas as a single
225       unit with the same binding compiler switches.
226
227       Please keep the following list of restrictions in mind when running
228       xjc. Most of these issues only apply when compiling multiple schemas
229       with multiple invocations of xjc.
230
231          o To compile multiple schemas at the same time, keep the following
232            precedence rules for the target Java package name in mind:
233
234             1. The "-p" command line option takes the highest precedence.
235
236             2. <jaxb:package> customization
237
238             3. If targetNamespace is declared, apply targetNamespace -> Java
239                package name algorithm defined in the specification.
240
241             4. If no targetNamespace is declared, use a hardcoded package
242                named "generated".
243
244          o It is not legal to have more than one <jaxb:schemaBindings> per
245            namespace, so it is impossible to have two schemas in the same
246            target namespace compiled into different Java packages.
247
248          o All schemas being compiled into the same Java package must be sub‐
249            mitted to the XJC binding compiler at the same time - they cannot
250            be compiled independently and work as expected.
251
252          o Element substitution groups spread across multiple schema files
253            must be compiled at the same time.
254
255

See Also

257          o Running the binding compiler (XJC): [ command-line instructions @
258            https://jaxb.dev.java.net/nonav/2.1.3/docs/xjc.html, using the XJC
259            Ant task @
260            https://jaxb.dev.java.net/nonav/2.1.3/docs/xjcTask.html]
261
262          o Java Architecture for XML Binding (JAXB) @
263            http://docs.oracle.com/javase/7/docs/tech
264            notes/guides/xml/jaxb/index.html
265
266
267                                  16 Mar 2012                           xjc(1)
Impressum