blob: 068def7767467037471b54b8d201f5c88dc6bbba [file] [log] [blame]
michaelm5ac8c152012-03-06 20:34:38 +00001." Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
2." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3."
4." This code is free software; you can redistribute it and/or modify it
5." under the terms of the GNU General Public License version 2 only, as
6." published by the Free Software Foundation.
7."
8." This code is distributed in the hope that it will be useful, but WITHOUT
9." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11." version 2 for more details (a copy is included in the LICENSE file that
12." accompanied this code).
13."
14." You should have received a copy of the GNU General Public License version
15." 2 along with this work; if not, write to the Free Software Foundation,
16." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17."
18." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19." or visit www.oracle.com if you need additional information or have any
20." questions.
21."
22.TH xjc 1 "10 May 2011"
23
24.LP
25.SH "Name"
26xjc \- Java(TM) Architecture for XML Binding
27.br
28Binding Compiler
29.LP
30.LP
31\f3Specification Version:\fP 2.1
32.br
33\f3Reference Implementation (RI) Version:\fP 2.1.3
34.LP
35.SH "Launching xjc"
36.LP
37.LP
38The binding compiler can be launched using the appropriate \f2xjc\fP shell script in the \f2bin\fP directory for your platform. We also provide an Ant task to run the binding complier \- see the instructions for
39.na
40\f2using the XJC Ant task\fP @
41.fi
42https://jaxb.dev.java.net/nonav/2.1.3/docs/xjcTask.html.
43.LP
44.LP
45\f2% xjc \-help\fP
46.LP
47.SS
48Output
49.LP
50.nf
51\f3
52.fl
53Usage: xjc [\-options ...] <schema file/URL/dir/jar> ... [\-b <bindinfo>] ...
54.fl
55If dir is specified, all schema files in it will be compiled.
56.fl
57If jar is specified, /META\-INF/sun\-jaxb.episode binding file will be compiled.
58.fl
59Options:
60.fl
61 \-nv : do not perform strict validation of the input schema(s)
62.fl
63 \-extension : allow vendor extensions \- do not strictly follow the Compatibility Rules and App E.2 from the JAXB Spec
64.fl
65 \-b <file/dir> : specify external bindings files (each <file> must have its own \-b); if a directory is given, **/*.xjb is searched
66.fl
67 \-d <dir> : generated files will go into this directory
68.fl
69 \-p <pkg> : specifies the target package
70.fl
71 \-httpproxy <proxy> : set HTTP/HTTPS proxy; format is [user[:password]@]proxyHost:proxyPort
72.fl
73 \-httpproxyfile <f> : works like \-httpproxy but takes the argument in a file to protect password
74.fl
75 \-classpath <arg> : specify where to find user class files
76.fl
77 \-catalog <file> : specify catalog files to resolve external entity references; support TR9401, XCatalog, and OASIS XML Catalog format
78.fl
79 \-readOnly : generated files will be in read\-only mode
80.fl
81 \-npa : suppress generation of package level annotations (**/package\-info.java)
82.fl
83 \-no\-header : suppress generation of a file header with timestamp
84.fl
85 \-target 2.0 : behave like XJC 2.0 and generate code that doesnt use any 2.1 features
86.fl
87 \-xmlschema : treat input as W3C XML Schema (default)
88.fl
89 \-relaxng : treat input as RELAX NG (experimental,unsupported)
90.fl
91 \-relaxng\-compact : treat input as RELAX NG compact syntax (experimental,unsupported)
92.fl
93 \-dtd : treat input as XML DTD (experimental,unsupported)
94.fl
95 \-wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported)
96.fl
97 \-verbose : be extra verbose
98.fl
99 \-quiet : suppress compiler output
100.fl
101 \-help : display this help message
102.fl
103 \-version : display version information
104.fl
105
106.fl
107
108.fl
109Extensions:
110.fl
111 \-Xlocator : enable source location support for generated code
112.fl
113 \-Xsync\-methods : generate accessor methods with the 'synchronized' keyword
114.fl
115 \-mark\-generated : mark the generated code as @javax.annotation.Generated
116.fl
117 \-episode <FILE> : generate the episode file for separate compilation
118.fl
119\fP
120.fi
121
122.LP
123.SH "OPTIONS"
124.LP
125.RS 3
126.TP 3
127\-nv
128By default, the XJC binding compiler performs strict validation of the source schema before processing it. Use this option to disable strict schema validation. This does not mean that the binding compiler will not perform any validation, it simply means that it will perform less\-strict validation.
129.TP 3
130\-extension
131By default, the XJC binding compiler strictly enforces the rules outlined in the Compatibility chapter of the JAXB Specification. Appendix E.2 defines a set of W3C XML Schema features that are not completely supported by JAXB v1.0. In some cases, you may be allowed to use them in the "\-extension" mode enabled by this switch. 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
132.TP 3
133\-b <file>
134Specify one or more external binding files to process. (Each binding file must have its own \f2"\-b"\fP 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: \f2xjc schema1.xsd schema2.xsd schema3.xsd \-b bindings123.xjb\fP
135.br
136\f2xjc schema1.xsd schema2.xsd schema3.xsd \-b bindings1.xjb \-b bindings2.xjb \-b bindings3.xjb\fP In addition, the ordering of the schema files and binding files on the command line does not matter.
137.TP 3
138\-d <dir>
139By default, the XJC binding compiler will generate the Java content classes in the current directory. Use this option to specify an alternate output directory. The output directory must already exist, the XJC binding compiler will not create it for you.
140.TP 3
141\-p <pkg>
142Specifying a target package via this command\-line option overrides any binding customization for package name and the default package name algorithm defined in the specification.
143.TP 3
144\-httpproxy <proxy>
145Specify the HTTP/HTTPS proxy. The format is [user[:password]@]proxyHost[:proxyPort]. The old \f2\-host\fP and \f2\-port\fP are still supported by the RI for backwards compatibility, but they have been deprecated. Note that the password specified with this option is an argument that is visible to other users who use the \f2top\fP command, for example. For greater security, use \f2\-httpproxyfile\fP, below.
146.TP 3
147\-httpproxyfile <file>
148Specify the HTTP/HTTPS proxy using a file. Same format as above, but the password specified in the file is not visible to other users.
149.TP 3
150\-classpath <arg>
151Specify where to find client application class files used by the \f2<jxb:javaType>\fP and \f2<xjc:superClass>\fP customizations.
152.TP 3
153\-catalog <file>
154Specify catalog files to resolve external entity references. Supports TR9401, XCatalog, and OASIS XML Catalog format. Please read the XML Entity and URI Resolvers document or the \f2catalog\-resolver\fP sample application.
155.TP 3
156\-readOnly
157By default, the XJC binding compiler does not write\-protect the Java source files it generates. Use this option to force the XJC binding compiler to mark the generated Java sources read\-only.
158.TP 3
159\-npa
160Supress 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.
161.TP 3
162\-no\-header
163Supress the generation of a file header comment that includes some note and timestamp. Using this makes the generated code more diff\-friendly.
164.TP 3
165\-target 2.0
166Avoid generating code that relies on any JAXB 2.1 features. This will allow the generated code to run with JAXB 2.0 runtime (such as JavaSE 6.)
167.TP 3
168\-xmlschema
169Treat input schemas as W3C XML Schema (default). If you do not specify this switch, your input schemas will be treated as W3C XML Schema.
170.TP 3
171\-relaxng
172Treat input schemas as RELAX NG (experimental, unsupported). Support for RELAX NG schemas is provided as a JAXB Vendor Extension.
173.TP 3
174\-relaxng\-compact
175Treat input schemas as RELAX NG compact syntax(experimental, unsupported). Support for RELAX NG schemas is provided as a JAXB Vendor Extension.
176.TP 3
177\-dtd
178Treat input schemas as XML DTD (experimental, unsupported). Support for RELAX NG schemas is provided as a JAXB Vendor Extension.
179.TP 3
180\-wsdl
181Treat input as WSDL and compile schemas inside it (experimental,unsupported).
182.TP 3
183\-quiet
184Suppress compiler output, such as progress information and warnings.
185.TP 3
186\-verbose
187Be extra verbose, such as printing informational messages or displaying stack traces upon some errors.
188.TP 3
189\-help
190Display a brief summary of the compiler switches.
191.TP 3
192\-version
193Display the compiler version information.
194.TP 3
195<schema file/URL/dir>
196Specify one or more schema files to compile. If you specify a directory, then xjc will scan it for all schema files and compile them.
197.RE
198
199.LP
200.SS
201Non\-Standard Command Line Options
202.LP
203.RS 3
204.TP 3
205\-Xlocator
206Causes the generated code to expose SAX Locator information about the source XML in the Java bean instances after unmarshalling.
207.TP 3
208\-Xsync\-methods
209Causes all of the generated method signatures to include the \f2synchronized\fP keyword.
210.TP 3
211\-mark\-generated
212Mark the generated code with the annotation \f2@javax.annotation.Generated\fP.
213.TP 3
214\-episode <file>
215Generate the specified episode file for separate compilation.
216.RE
217
218.LP
219.SS
220Deprecated and Removed Command Line Options
221.LP
222.RS 3
223.TP 3
224\-host & \-port
225These options have been deprecated and replaced with the \f3\-httpproxy\fP option. For backwards compatibility, we will continue to support these options, but they will no longer be documented and may be removed from future releases.
226.TP 3
227\-use\-runtime
228Since the JAXB 2.0 specification has defined a portable runtime, it is no longer necessary for the JAXB RI to generate **/impl/runtime packages. Therefore, this switch is obsolete and has been removed.
229.TP 3
230\-source
231The \-source compatibility switch was introduced in the first JAXB 2.0 Early Access release. We have decided to remove this switch from future releases of JAXB 2.0. If you need to generate 1.0.x code, please use an installation of the 1.0.x codebase.
232.RE
233
234.LP
235.SS
236Compiler Restrictions
237.LP
238.LP
239In general, it is safest to compile all related schemas as a single unit with the same binding compiler switches.
240.LP
241.LP
242Please 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.
243.LP
244.RS 3
245.TP 2
246o
247To compile multiple schemas at the same time, keep the following precedence rules for the target Java package name in mind:
248.RS 3
249.TP 3
2501.
251The "\f2\-p\fP" command line option takes the highest precedence.
252.TP 3
2532.
254<\f2jaxb:package\fP> customization
255.TP 3
2563.
257If \f2targetNamespace\fP is declared, apply \f2targetNamespace\fP \-> Java package name algorithm defined in the specification.
258.TP 3
2594.
260If no \f2targetNamespace\fP is declared, use a hardcoded package named "generated".
261.RE
262.TP 2
263o
264It is not legal to have more than one <\f2jaxb:schemaBindings\fP> per namespace, so it is impossible to have two schemas in the same target namespace compiled into different Java packages.
265.TP 2
266o
267All 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.
268.TP 2
269o
270Element substitution groups spread across multiple schema files must be compiled at the same time.
271.RE
272
273.LP
274.SH "See Also"
275.LP
276.RS 3
277.TP 2
278o
279Running the binding compiler (XJC): [
280.na
281\f2command\-line instructions\fP @
282.fi
283https://jaxb.dev.java.net/nonav/2.1.3/docs/xjc.html,
284.na
285\f2using the XJC Ant task\fP @
286.fi
287https://jaxb.dev.java.net/nonav/2.1.3/docs/xjcTask.html]
288.TP 2
289o
290.na
291\f2Java Architecture for XML Binding (JAXB)\fP @
292.fi
293http://download.oracle.com/javase/7/docs/technotes/guides/xml/jaxb/index.html
294.RE
295
296.LP
297