jaxb-xjc.jar contains the XJC ant task, which allows XJC
to be invoked from the Ant
build tool. To use the XJC task, you need to include the following
statement in your build.xml:
If XJC is already available in your classpath, you can just write:
The XJC task supports the following parameter attributes.
| Attribute | Description | Required |
| schema | A schema file to be compiled | This or nested <schema> elements are required. |
| package | If specified, generated code will be placed under this Java package. This option is useful only when neither the schema nor the external binding file specifies one. | No |
| target |
Generated code will be written under this directory. If you specify
target="abc/def" and package="org.acme",
then files are generated to abc/def/org/acme.
| Yes |
| readonly |
Generate Java source files in the read-only mode if true
is specified. false by default.
| No |
Following nested element parameters are supported as well.
To compile more than one schema at the same time, use this nested file set.
Compiles myschema.xsd and places the generated files under
src/org/acme/foo.
Compiles all XML Schema files in the src directory places the generated files
under the appropriate packages in the src directory. This example
doesn't search sub-directories of the src directory to look for
schema files.