1xjc(1) General Commands Manual xjc(1)
2
3
4
5 NAME
6 xjc - Java(TM) Architecture for XML Binding
7 Binding Compiler Specification Version: 2.0
8 Reference Implementation (RI) Version: 2.0 ea3
9
10
12 The binding compiler can be launched using the appropriate xjc shell
13 script in the bin directory for your platform. We also provide an Ant
14 task to run the binding complier - see the instructions for using xjc
15 with Ant.
16
17 For Solaris/Linux
18
19 % /path/to/jaxb/bin/xjc.sh -help
20
21 For WindowsNT/2000/XP
22
23 > c:\path\to\jaxb\bin\xjc.bat -help
24
25 Output
26
27 Usage: xjc [-options ...] <schema_file/URL/dir> ... [-b <bindinfo>] ...
28 Options:
29 -nv : do not perform strict validation of the input schema(s)
30 -extension : allow vendor extensions - do not strictly follow the
31 Compatibility Rules and App E.2 from the JAXB Spec
32 -b <file> : specify external bindings files (each <file> must have its own -b)
33 -d <dir> : generated files will go into this directory
34 -p <pkg> : specifies the target package
35 -httpproxy <proxy> : set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost:proxyPort
36 -httpproxyfile <file>: set the proxy string (same format as above).
37 -classpath <arg> : specify where to find user class files
38 -catalog <file> : specify catalog files to resolve external entity references
39 support TR9401, XCatalog, and OASIS XML Catalog format.
40 -readOnly : generated files will be in read-only mode
41 -npa : suppress generation of package level annotations (**/package-info.java)
42 -xmlschema : treat input as W3C XML Schema (default)
43 -relaxng : treat input as RELAX NG (experimental,unsupported)
44 -relaxng-compact : treat input as RELAX NG compact syntax (experimental,unsupported)
45 -dtd : treat input as XML DTD (experimental,unsupported)
46 -wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported)
47 -verbose : be extra verbose
48 -quiet : suppress compiler output
49 -help : display this help message
50 -version : display version information
51
52
53 Execute the jaxb-xjc.jar JAR File
54
55 If all else fails, you should be able to execute the jaxb-xjc.jar
56 file:
57
58 For Solaris/Linux:
59 % java -jar $JAXB_HOME/lib/jaxb-xjc.jar -help
60
61 For Windows:
62 > java -jar %JAXB_HOME%\lib\jaxb-xjc.jar -help
63
64
65 This is equivalent of running "xjc.sh" or "xjc.bat", and it
66 allows you to set the JVM parameters.
67
69 -nv
70 By default, the XJC binding compiler performs strict validation
71 of the source schema before processing it. Use this option to
72 disable strict schema validation. This does not mean that the
73 binding compiler will not perform any validation, it simply means
74 that it will perform less-strict validation.
75
76 -extension
77 By default, the XJC binding compiler strictly enforces the rules
78 outlined in the Compatibility chapter of the JAXB Specification.
79 Appendix E.2 defines a set of W3C XML Schema features that are
80 not completely supported by JAXB v1.0. In some cases, you may be
81 allowed to use them in the "-extension" mode enabled by this
82 switch. In the default (strict) mode, you are also limited to
83 using only the binding customizations defined in the specifica‐
84 tion. By using the "-extension" switch, you will be allowed to
85 use the JAXB Vendor Extensions.
86
87 -b <file>
88 Specify one or more external binding files to process. (Each
89 binding file must have it's own "-b" switch.) The syntax of the
90 external binding files is extremely flexible. You may have a sin‐
91 gle binding file that contains customizations for multiple
92 schemas or you can break the customizations into multiple bind‐
93 ings files:
94
95
96 xjc schema1.xsd schema2.xsd schema3.xsd -b bindings123.xjb
97 xjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b bind‐
98 ings2.xjb -b bindings3.xjb
99 In addition, the ordering of the schema files and binding files on
100 the command line does not matter.
101
102 -d <dir>
103 By default, the XJC binding compiler will generate the Java con‐
104 tent classes in the current directory. Use this option to specify
105 an alternate output directory. The output directory must already
106 exist, the XJC binding compiler will not create it for you.
107
108 -p <pkg>
109 Specifying a target package via this command-line option over‐
110 rides any binding customization for package name and the default
111 package name algorithm defined in the specification.
112
113 -httpproxy <proxy>
114 Specify the HTTP/HTTPS proxy. The format is [user[:pass‐
115 word]@]proxyHost[:proxyPort]. The old -host and -port are still
116 supported by the RI for backwards compatibility, but they have
117 been deprecated. Note that the password specified with this
118 option is an argument that is visible to other users who use the
119 top command, for example. For greater security, use -httpproxy‐
120 file, below.
121
122 -httpproxyfile <file>
123 Specify the HTTP/HTTPS proxy using a file. Same format as above,
124 but the password specified in the file is not visible to other
125 users.
126
127 -classpath <arg>
128 Specify where to find client application class files used by the
129 <jxb:javaType> and <xjc:superClass> customizations.
130
131 -catalog <file>
132 Specify catalog files to resolve external entity references. Sup‐
133 ports TR9401, XCatalog, and OASIS XML Catalog format. Please read
134 the XML Entity and URI Resolvers document or the catalog-resolver
135 sample application.
136
137 -readOnly
138 By default, the XJC binding compiler does not write-protect the
139 Java source files it generates. Use this option to force the XJC
140 binding compiler to mark the generated Java sources read-only.
141
142 -npa
143 Supress the generation of package level annotations into **/pack‐
144 age-info.java. Using this switch causes the generated code to
145 internalize those annotations into the other generated classes.
146
147 -xmlschema
148 treat input schemas as W3C XML Schema (default). If you do not
149 specify this switch, your input schemas will be treated as W3C
150 XML Schema.
151
152 -relaxng
153 Treat input schemas as RELAX NG (experimental, unsupported). Sup‐
154 port for RELAX NG schemas is provided as a JAXB Vendor Extension.
155
156 -relaxng-compact
157 Treat input schemas as RELAX NG compact syntax(experimental,
158 unsupported). Support for RELAX NG schemas is provided as a JAXB
159 Vendor Extension.
160
161 -dtd
162 Treat input schemas as XML DTD (experimental, unsupported). Sup‐
163 port for RELAX NG schemas is provided as a JAXB Vendor Extension.
164
165 -wsdl
166 Treat input as WSDL and compile schemas inside it (experimen‐
167 tal,unsupported).
168
169 -quiet
170 Suppress compiler output, such as progress information and warn‐
171 ings..
172
173 -verbose
174 Be extra verbose, such as printing informational messages or dis‐
175 playing stack traces upon some errors..
176
177 -help
178 Display a brief summary of the compiler switches.
179
180 -version
181 Display the compiler version information.
182
183 <schema file/URL/dir>
184 Specify one or more schema files to compile. If you specify a
185 directory, then xjc will scan it for all schema files and compile
186 them.
187
188 Summary of Deprecated and Removed Command Line Options
189 -host & -port
190 These options have been deprecated and replaced with the
191 -httpproxy option. For backwards compatibility, we will con‐
192 tinue to support these options, but they will no longer be
193 documented and may be removed from future releases.
194
195 -use-runtime
196 Since the JAXB 2.0 specification has defined a portable run‐
197 time, it is no longer necessary for the JAXB RI to generate
198 **/impl/runtime packages. Therefore, this switch is obsolete
199 and has been removed.
200
201 -source
202 The -source compatibility switch was introduced in the first
203 JAXB 2.0 Early Access release. We have decided to remove this
204 switch from future releases of JAXB 2.0. If you need to gener‐
205 ate 1.0.x code, please use an installation of the 1.0.x code‐
206 base.
207
208 -Xlocator & -Xsync-methods
209 These switches have been disabled for now. We plan on releas‐
210 ing this functionality as a separate download in the future.
211
212
213 Compiler Restrictions
214 In general, it is safest to compile all related schemas as a single
215 unit with the same binding compiler switches.
216
217 Please keep the following list of restrictions in mind when running
218 xjc. Most of these issues only apply when compiling multiple schemas
219 with multiple invocations of xjc.
220
221 o To compile multiple schemas at the same time, keep the following
222 precedence rules for the target Java package name in mind:
223
224 1. The "-p" command line option takes the highest precedence.
225
226 2. <jaxb:package> customization
227
228 3. If targetNamespace is declared, apply targetNamespace -> Java
229 package name algorithm defined in the specification.
230
231 4. If no targetNamespace is declared, use a hardcoded package
232 named "generated".
233
234 o It is not legal to have more than one <jaxb:schemaBindings> per
235 namespace, so it is impossible to have two schemas in the same
236 target namespace compiled into different Java packages.
237
238 o All schemas being compiled into the same Java package must be sub‐
239 mitted to the XJC binding compiler at the same time - they cannot
240 be compiled independently and work as expected.
241
242 o Element substitution groups spread across multiple schema files
243 must be compiled at the same time.
244
245
247 o JAXB 2.0:
248
249 * Release Notes @
250 http://java.sun.com/webservices/docs/2.0/jaxb/ReleaseNotes.html
251
252 * XJC @
253 http://java.sun.com/webservices/docs/2.0/jaxb/xjc.html
254
255 * XJCTask @
256 http://java.sun.com/webservices/docs/2.0/jaxb/xjcTask.html
257
258 * SchemaGen @
259 http://java.sun.com/webservices/docs/2.0/jaxb/schemagen.html
260
261 * schemagenTask @
262 http://java.sun.com/webservices/docs/2.0/jaxb/schemagen‐
263 Task.html
264
265 * Sample Apps @
266 http://java.sun.com/webservices/docs/2.0/jaxb/samples.html
267
268 * Changelog @
269 http://java.sun.com/webservices/docs/2.0/jaxb/changelog2.html
270
271 o JAXB 1.0.x:
272
273 * Release Notes @
274 http://java.sun.com/webservices/docs/2.0/jaxb/jaxb-1_0.html
275
276 * Changelog @
277 http://java.sun.com/webservices/docs/2.0/jaxb/changelog.html
278
279 o JAXB RI Extensions:
280
281 * Runtime Properties @
282 http://java.sun.com/webservices/docs/2.0/jaxb/vendorProper‐
283 ties.html
284
285 * XJC Customizations @
286 http://java.sun.com/webservices/docs/2.0/jaxb/vendorCustomiza‐
287 tions.html
288
289 * Develop Plugins @
290 http://java.sun.com/webservices/docs/2.0/jaxb/developPlug‐
291 ins.html
292
293 o JAXB RI Schema Languages:
294
295 * W3C XML Schema @
296 http://java.sun.com/webservices/docs/2.0/jaxb/ven‐
297 dorSchemaLangs.html#xschema
298
299 * RELAX NG @
300 http://java.sun.com/webservices/docs/2.0/jaxb/ven‐
301 dorSchemaLangs.html#relaxng
302
303 * DTD @
304 http://java.sun.com/webservices/docs/2.0/jaxb/ven‐
305 dorSchemaLangs.html#dtd
306
307 o JAXB Community:
308
309 * Java.net Homepage @
310 http://jaxb.dev.java.net
311
312 * Developer interest list @
313 https://jaxb.dev.java.net/servlets/ProjectMailingListList
314
315 * FAQ @
316 https://jaxb.dev.java.net/faq/index.html
317
318
319 07 Aug 2006 xjc(1)