1xjc(1) Java Web Services Tools xjc(1)
2
3
4
6 xjc - Compiles an XML schema file into fully annotated Java classes.
7
9 xjc [ options ] schema file/URL/dir/jar ... [-b bindinfo ] ...
10
11
12 options
13 The command-line options. See Options.
14
15 schema file/URL/dir/jar ...
16 The location of the XML schema file. If dir is specified, then
17 all schema files in it are compiled. If jar is specified, then
18 the /META-INF/sun-jaxb.episode binding file is compiled.
19
20 -b bindinfo
21 The location of the bindings files.
22
24 Start the binding compiler with the appropriate xjc shell script in the
25 bin directory for your platform. There is also an Ant task to run the
26 binding complier. See Using the XJC with Ant at
27 http://jaxb.java.net/nonav/2.1.3/docs/xjcTask.html
28
30 · See also Nonstandard Options
31
32 · See also Deprecated and Removed Options
33
34 -nv
35 By default, the XJC binding compiler performs strict validation of
36 the source schema before processing it. Use this option to disable
37 strict schema validation. This does not mean that the binding
38 compiler will not perform any validation, but means that it will
39 perform a less-strict validation.
40
41 -extension
42 By default, the XJC binding compiler strictly enforces the rules
43 outlined in the Compatibility chapter of the JAXB Specification.
44 Appendix E.2 defines a set of W3C XML Schema features that are not
45 completely supported by JAXB v1.0. In some cases, you may be allowed
46 to use them in the -extension mode enabled by this switch. In the
47 default (strict) mode, you are also limited to using only the binding
48 customization defined in the specification. By using the -extension
49 switch, you will be allowed to use the JAXB Vendor Extensions.
50
51 -b file
52 Specifies one or more external binding files to process. Each binding
53 file must have its own -b switch. The syntax of the external binding
54 files is flexible. You can have a single binding file that contains
55 customization for multiple schemas or you can break the customization
56 into multiple bindings files: xjc schema1.xsd schema2.xsd schema3.xsd
57 -b bindings123.xjbxjc schema1.xsd schema2.xsd schema3.xsd -b
58 bindings1.xjb -b bindings2.xjb -b bindings3.xjb. In addition, the
59 ordering of the schema files and binding files on the command line
60 does not matter.
61
62 -d dir
63 By default, the XJC binding compiler generates the Java content
64 classes in the current directory. Use this option to specify an
65 alternate output directory. The output directory must already exist.
66 The XJC binding compiler does not create it for you.
67
68 -p pkg
69 When you specify a target package with this command-line option, it
70 overrides any binding customization for the package name and the
71 default package name algorithm defined in the specification.
72
73 -httpproxy proxy
74 Specifies the HTTP or HTTPS proxy in the format
75 [user[:password]@]proxyHost[:proxyPort]. The old -host and -port
76 options are still supported by the RI for backward compatibility, but
77 they were deprecated. The password specified with this option is an
78 argument that is visible to other users who use the top command. For
79 greater security, use the -httpproxyfile option.
80
81 -httpproxyfile file
82 Specifies the HTTP or HTTPS proxy with a file. The same format as the
83 -httpproxy option, but the password specified in the file is not
84 visible to other users.
85
86 -classpath arg
87 Specifies where to find client application class files used by the
88 jxb:javaType and xjc:superClass customization.
89
90 -catalog file
91 Specifies catalog files to resolve external entity references.
92 Supports the TR9401, XCatalog, and OASIS XML Catalog formats. See XML
93 Entity and URI Resolvers at http://xerces.apache.org/xml-
94 commons/components/resolver/resolver-article.html
95
96 -readOnly
97 By default, the XJC binding compiler does not write-protect the Java
98 source files it generates. Use this option to force the XJC binding
99 compiler to mark the generated Java sources as read-only.
100
101 -npa
102 Suppresses the generation of package level annotations into
103 **/package-info.java. Using this switch causes the generated code to
104 internalize those annotations into the other generated classes.
105
106 -no-header
107 Suppresses the generation of a file header comment that includes some
108 note and time stamp. Using this makes the generated code more
109 compatible with the diff command.
110
111 -target 2.0
112 Avoids generating code that relies on any JAXB 2.1 features. This
113 will allow the generated code to run with JAXB 2.0 runtime
114 environment (such as Java SE 6).
115
116 -xmlschema
117 Treats input schemas as W3C XML Schema (default). If you do not
118 specify this switch, then your input schemas are treated as though
119 they are W3C XML Schemas.
120
121 -relaxing
122 Treats input schemas as RELAX NG (experimental and unsupported).
123 Support for RELAX NG schemas is provided as a JAXB Vendor Extension.
124
125 -relaxing-compact
126 Treat input schemas as RELAX NG compact syntax (experimental and
127 unsupported). Support for RELAX NG schemas is provided as a JAXB
128 Vendor Extension.
129
130 -dtd
131 Treats input schemas as XML DTD (experimental and unsupported).
132 Support for RELAX NG schemas is provided as a JAXB Vendor Extension.
133
134 -wsdl
135 Treats input as WSDL and compiles schemas inside it (experimental and
136 unsupported).
137
138 -quiet
139 Suppress compiler output, such as progress information and warnings.
140
141 -verbose
142 Be extra verbose, such as printing informational messages or
143 displaying stack traces upon some errors.
144
145 -help
146 Displays a brief summary of the compiler switches.
147
148 -version
149 Displays the compiler version information.
150
151 schema file/URL/dir
152 Specifies one or more schema files to compile. If you specify a
153 directory, then the xjc command scans it for all schema files and
154 compiles them.
155
156 NONSTANDARD OPTIONS
157 -XLocator
158 Causes the generated code to expose SAX Locator information
159 about the source XML in the Java bean instances after
160 unmarshalling.
161
162 -Xsync-methods
163 Causes all of the generated method signatures to include the
164 synchronized keyword.
165
166 -mark-generated
167 Marks the generated code with the annotation
168 @javax.annotation.Generated.
169
170 -episode file
171 Generates the specified episode file for separate compilation.
172
173 DEPRECATED AND REMOVED OPTIONS
174 -host & -port
175 These options are replaced with the -httpproxy option. For
176 backward compatibility, these options are supported, but will
177 not be documented and might be removed from future releases.
178
179 -use-runtime
180 Because the JAXB 2.0 specification has defined a portable
181 runtime environment, it is no longer necessary for the JAXB RI
182 to generate **/impl/runtimepackages. Therefore, this switch is
183 obsolete and was removed.
184
185 -source
186 The -source compatibility switch was introduced in the first
187 JAXB 2.0 Early Access release. This switch is removed from
188 future releases of JAXB 2.0. If you need to generate 1.0.x code,
189 then use an installation of the 1.0.x code base.
190
192 In general, it is safest to compile all related schemas as a single
193 unit with the same binding compiler switches. Keep the following list
194 of restrictions in mind when running the xjc command. Most of these
195 issues only apply when you compile multiple schemas with multiple
196 invocations of the xjc command.
197
198 To compile multiple schemas at the same time, keep the following
199 precedence rules for the target Java package name in mind:
200
201 1. The -p option has the highest precedence.
202
203 2. jaxb:package customization.
204
205 3. If targetNamespace is declared, then apply the targetNamespace to
206 the Java package name algorithm defined in the specification.
207
208 4. If no targetNamespace is declared, then use a hard coded package
209 named generated.
210
211 You cannot have more than one jaxb:schemaBindings per name space, so it
212 is impossible to have two schemas in the same target name space
213 compiled into different Java packages.
214
215 All schemas being compiled into the same Java package must be submitted
216 to the XJC binding compiler at the same time. They cannot be compiled
217 independently and work as expected.
218
219 Element substitution groups that are spread across multiple schema
220 files must be compiled at the same time.
221
223 · Binding Compiler (xjc) at
224 http://jaxb.java.net/nonav/2.2.3u1/docs/xjc.html
225
226 · Java Architecture for XML Binding (JAXB) at
227 http://www.oracle.com/technetwork/articles/javase/index-140168.html
228
229
230
231JDK 8 21 November 2013 xjc(1)