2.5.1 csmxjc command (Binding from the XML Schema to Java)

Organization of this subsection
(1) Format
(2) Function
(3) Options
(4) Input schema document
(5) Output Java source
(6) Return value

(1) Format

csmxjc [option [option argument] ] ... Input schema document

You can omit the option. Always specify the option before the schema document.

(2) Function

Schema compiler for binding from the XML Schema to Java.

(3) Options

-b external-binding-file
Specifies one external binding file. For details on how to specify names of the external binding files, see the subsection Characters that can be specified in the file name or directory name of the command, path delimiting characters, and how to specify a path.
If this option is omitted, a java class will be generated without using external binding files.
-d output-destination-directory
Specifies the output destination directory of the Java source. For details on how to specify the directory name, see Characters that can be specified in the file name or directory name of the command, path delimiting characters, and how to specify a path.
If omitted, the current directory will become the output destination directory.
-mark-generated
Adds the @javax.annotation.Generated annotation in the generated Java source.
If omitted, the @javax.annotation.Generated annotation is not added in the Java source.
The format of the @javax.annotation.Generated annotation added in the Java source is as follows. Different values are entered in the part indicated in italics, when the Java source is generated.
@Generated(value = "com.cosminexus.jaxb.tools.xjc.Driver", date = "yyyy-MM-ddTHH:mm:ssRFC822 timezone")
The following table describes the elements of the @javax.annotation.Generated annotation and the values set up in XML Processor:

Table 2-5 Elements of the @javax.annotation.Generated annotation and values set up in XML Processor

Element nameExplanationValue
valueCompletely modified class name of the schema compilercom.cosminexus.jaxb.tools.xjc.Driver
dateDate and time when the Java source was generated from the schemayyyy-MM-ddTHH:mm:ssRFC822 timezone#
#
For details on the output format, see the Date and time pattern of the java.text.SimpleDateFormat class.

(4) Input schema document

You can specify one file name for the input schema document. For details on the characters that can be specified in the file name, path delimiting characters, and how to specify a path, see Characters that can be specified in the file name or directory name of the command, path delimiting characters, and how to specify a path.

(5) Output Java source

Format of the output Java source
The following figure gives an overview of the format of Java source output by the schema compiler.

Figure 2-10 Overview of the format of Java source output by the schema compiler

[Figure]
The details of format of the output Java source are as follows:
  1. Header
    Header indicating that the file was generated by Cosminexus XML Processor. The following header is inserted:

    //
    // This file was generated by Cosminexus XML Processor 09-50
    // Any modifications to this file will be lost upon recompilation of the source schema.
    //

  2. package statement and import statement code
    The package statement and import statement required in the source is generated. The contents of the generated package statement or import statement depend on the schema document entered in the schema compiler.
  3. javadoc
    The contents of javadoc are generated automatically for the class generated from the input schema document. The contents of javadoc are dependent on the schema document entered in the schema compiler.
  4. Java class
    The class generated from the input schema document is generated. The contents of the Java class depend on the schema document entered in the schema compiler.
Package and output destination of the output Java source
The package name and output destination of the output Java source is as follows:
The package name of the output Java source is determined as per the following priority order. The output destination of the Java source is determined by assuming the current directory or the directory specified in the -d option as the standard directory, and applying the following rules in an order:
  1. When the package name is specified by custom binding
    The package name specified in custom binding (jaxb:package element) becomes the package name of the output Java source. Convert the package name to the directory name, and create the directory name under the standard directory. Output the Java source in the created directory.
  2. When the targetNamespace attribute is specified in the input schema document
    From the target namespace described in the input schema document, generate the package name of the output Java source based on the JAXB specifications. Convert the generated package name to the directory name, and create the directory name under the standard directory. Output the Java source in the created directory.
  3. When the package name is not specified by custom binding in the input schema document, and when the targetNamespace attribute is also not specified
    The package name of Java source will be generated. Create a directory called generated under the standard directory, and output the Java source in the created directory.
If a Java source with the same name exists in the output destination directory, then that Java source will be overwritten.

(6) Return value

0:
Normal termination.
Value other than 0:
Abnormal termination.