xjc.1 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. '\" t
  2. .\" Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  3. .\" Arch: generic
  4. .\" Software: JDK 8
  5. .\" Date: 21 November 2013
  6. .\" SectDesc: Java Web Services Tools
  7. .\" Title: xjc.1
  8. .\"
  9. .if n .pl 99999
  10. .TH xjc 1 "21 November 2013" "JDK 8" "Java Web Services Tools"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH NAME
  31. xjc \- Compiles an XML schema file into fully annotated Java classes\&.
  32. .SH SYNOPSIS
  33. .sp
  34. .nf
  35. \fBxjc\fR [ \fIoptions\fR ] \fBschema\fR \fIfile/URL/dir/jar\fR \&.\&.\&. [\fB\-b\fR \fIbindinfo\fR ] \&.\&.\&.
  36. .fi
  37. .sp
  38. .TP
  39. \fIoptions\fR
  40. The command-line options\&. See Options\&.
  41. .TP
  42. schema \fIfile/URL/dir/jar \&.\&.\&.\fR
  43. The location of the XML schema file\&. If \f3dir\fR is specified, then all schema files in it are compiled\&. If \f3jar\fR is specified, then the \f3/META-INF/sun-jaxb\&.episode\fR binding file is compiled\&.
  44. .TP
  45. -b \fIbindinfo\fR
  46. .br
  47. The location of the bindings files\&.
  48. .SH DESCRIPTION
  49. Start the binding compiler with the appropriate \f3xjc\fR shell script in the bin directory for your platform\&. There is also an Ant task to run the binding complier\&. See Using the XJC with Ant at http://jaxb\&.java\&.net/nonav/2\&.1\&.3/docs/xjcTask\&.html
  50. .SH OPTIONS
  51. .TP 0.2i
  52. \(bu
  53. See also Nonstandard Options
  54. .TP 0.2i
  55. \(bu
  56. See also Deprecated and Removed Options
  57. .TP
  58. -nv
  59. .br
  60. By 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, but means that it will perform a less-strict validation\&.
  61. .TP
  62. -extension
  63. .br
  64. By 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 \f3-extension\fR mode enabled by this switch\&. In the default (strict) mode, you are also limited to using only the binding customization defined in the specification\&. By using the \f3-extension\fR switch, you will be allowed to use the JAXB Vendor Extensions\&.
  65. .TP
  66. -b \fIfile\fR
  67. .br
  68. Specifies one or more external binding files to process\&. Each binding file must have its own \f3-b\fR switch\&. The syntax of the external binding files is flexible\&. You can have a single binding file that contains customization for multiple schemas or you can break the customization into multiple bindings files: \f3xjc schema1\&.xsd schema2\&.xsd schema3\&.xsd -b bindings123\&.xjb\fR\f3xjc schema1\&.xsd schema2\&.xsd schema3\&.xsd -b bindings1\&.xjb -b bindings2\&.xjb -b bindings3\&.xjb\fR\&. In addition, the ordering of the schema files and binding files on the command line does not matter\&.
  69. .TP
  70. -d \fIdir\fR
  71. .br
  72. By default, the XJC binding compiler generates 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 does not create it for you\&.
  73. .TP
  74. -p \fIpkg\fR
  75. .br
  76. When you specify a target package with this command-line option, it overrides any binding customization for the package name and the default package name algorithm defined in the specification\&.
  77. .TP
  78. -httpproxy \fIproxy\fR
  79. .br
  80. Specifies the HTTP or HTTPS proxy in the format \fI[user[:password]@]proxyHost[:proxyPort]\fR\&. The old \f3-host\fR and \f3-port\fR options are still supported by the RI for backward compatibility, but they were deprecated\&. The password specified with this option is an argument that is visible to other users who use the top command\&. For greater security, use the \f3-httpproxyfile\fR option\&.
  81. .TP
  82. -httpproxyfile file
  83. .br
  84. Specifies the HTTP or HTTPS proxy with a file\&. The same format as the \f3-httpproxy\fR option, but the password specified in the file is not visible to other users\&.
  85. .TP
  86. -classpath arg
  87. .br
  88. Specifies where to find client application class files used by the \fIjxb:javaType\fR and xjc:\fIsuperClass\fR customization\&.
  89. .TP
  90. -catalog file
  91. .br
  92. Specifies catalog files to resolve external entity references\&. Supports the TR9401, XCatalog, and OASIS XML Catalog formats\&. See XML Entity and URI Resolvers at http://xerces\&.apache\&.org/xml-commons/components/resolver/resolver-article\&.html
  93. .TP
  94. -readOnly
  95. .br
  96. By 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 as read-only\&.
  97. .TP
  98. -npa
  99. .br
  100. Suppresses the generation of package level annotations into \f3**/package-info\&.java\fR\&. Using this switch causes the generated code to internalize those annotations into the other generated classes\&.
  101. .TP
  102. -no-header
  103. .br
  104. Suppresses the generation of a file header comment that includes some note and time stamp\&. Using this makes the generated code more compatible with the \f3diff\fR command\&.
  105. .TP
  106. -target 2\&.0
  107. .br
  108. Avoids generating code that relies on any JAXB 2\&.1 features\&. This will allow the generated code to run with JAXB 2\&.0 runtime environment (such as Java SE 6)\&.
  109. .TP
  110. -xmlschema
  111. .br
  112. Treats input schemas as W3C XML Schema (default)\&. If you do not specify this switch, then your input schemas are treated as though they are W3C XML Schemas\&.
  113. .TP
  114. -relaxing
  115. .br
  116. Treats input schemas as RELAX NG (experimental and unsupported)\&. Support for RELAX NG schemas is provided as a JAXB Vendor Extension\&.
  117. .TP
  118. -relaxing-compact
  119. .br
  120. Treat input schemas as RELAX NG compact syntax (experimental and unsupported)\&. Support for RELAX NG schemas is provided as a JAXB Vendor Extension\&.
  121. .TP
  122. -dtd
  123. .br
  124. Treats input schemas as XML DTD (experimental and unsupported)\&. Support for RELAX NG schemas is provided as a JAXB Vendor Extension\&.
  125. .TP
  126. -wsdl
  127. .br
  128. Treats input as WSDL and compiles schemas inside it (experimental and unsupported)\&.
  129. .TP
  130. -quiet
  131. .br
  132. Suppress compiler output, such as progress information and warnings\&.
  133. .TP
  134. -verbose
  135. .br
  136. Be extra verbose, such as printing informational messages or displaying stack traces upon some errors\&.
  137. .TP
  138. -help
  139. .br
  140. Displays a brief summary of the compiler switches\&.
  141. .TP
  142. -version
  143. .br
  144. Displays the compiler version information\&.
  145. .TP
  146. \fIschema file/URL/dir\fR
  147. Specifies one or more schema files to compile\&. If you specify a directory, then the \f3xjc\fR command scans it for all schema files and compiles them\&.
  148. .SS NONSTANDARD\ OPTIONS
  149. .TP
  150. -XLocator
  151. .br
  152. Causes the generated code to expose SAX Locator information about the source XML in the Java bean instances after unmarshalling\&.
  153. .TP
  154. -Xsync-methods
  155. .br
  156. Causes all of the generated method signatures to include the \f3synchronized\fR keyword\&.
  157. .TP
  158. -mark-generated
  159. .br
  160. Marks the generated code with the annotation \f3@javax\&.annotation\&.Generated\fR\&.
  161. .TP
  162. -episode file
  163. .br
  164. Generates the specified episode file for separate compilation\&.
  165. .SS DEPRECATED\ AND\ REMOVED\ OPTIONS
  166. .TP
  167. -host & -port
  168. .br
  169. These options are replaced with the \f3-httpproxy\fR option\&. For backward compatibility, these options are supported, but will not be documented and might be removed from future releases\&.
  170. .TP
  171. -use-runtime
  172. .br
  173. Because the JAXB 2\&.0 specification has defined a portable runtime environment, it is no longer necessary for the JAXB RI to generate \f3**/impl/runtime\fRpackages\&. Therefore, this switch is obsolete and was removed\&.
  174. .TP
  175. -source
  176. .br
  177. The \f3-source\fR compatibility switch was introduced in the first JAXB 2\&.0 Early Access release\&. This switch is removed from future releases of JAXB 2\&.0\&. If you need to generate 1\&.0\&.x code, then use an installation of the 1\&.0\&.x code base\&.
  178. .SH COMPILER\ RESTRICTIONS
  179. In general, it is safest to compile all related schemas as a single unit with the same binding compiler switches\&. Keep the following list of restrictions in mind when running the \f3xjc\fR command\&. Most of these issues only apply when you compile multiple schemas with multiple invocations of the \f3xjc\fR command\&.
  180. .PP
  181. To compile multiple schemas at the same time, keep the following precedence rules for the target Java package name in mind:
  182. .TP 0.4i
  183. 1\&.
  184. The \f3-p\fR option has the highest precedence\&.
  185. .TP 0.4i
  186. 2\&.
  187. \fIjaxb:package\fR customization\&.
  188. .TP 0.4i
  189. 3\&.
  190. If \f3targetNamespace\fR is declared, then apply the \f3t\fR\f3argetNamespace\fR to the Java package name algorithm defined in the specification\&.
  191. .TP 0.4i
  192. 4\&.
  193. If no \f3targetNamespace\fR is declared, then use a hard coded package named \f3generated\fR\&.
  194. .PP
  195. You cannot have more than one \fIjaxb:schemaBindings\fR per name space, so it is impossible to have two schemas in the same target name space compiled into different Java packages\&.
  196. .PP
  197. All 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\&.
  198. .PP
  199. Element substitution groups that are spread across multiple schema files must be compiled at the same time\&.
  200. .SH SEE\ ALSO
  201. .TP 0.2i
  202. \(bu
  203. Binding Compiler (xjc) at http://jaxb\&.java\&.net/nonav/2\&.2\&.3u1/docs/xjc\&.html
  204. .TP 0.2i
  205. \(bu
  206. Java Architecture for XML Binding (JAXB) at http://www\&.oracle\&.com/technetwork/articles/javase/index-140168\&.html
  207. .RE
  208. .br
  209. 'pl 8.5i
  210. 'bp