2.5.2 csmschemagen command (Mapping from Java to the XML Schema)
- Organization of this subsection
(1) Format
csmschemagen [option [option argument] ] [package-info.java file name] Java source file name
You can omit the option and package-info.java file. Always specify the option and package-info.java before the Java source file name.
(2) Function
Schema generator for mapping from Java to the XML Schema.
(3) Options
- -d output-destination-directory
-
Specifies the output destination directory of the output schema document and intermediate file. For details on how to specify the output destination 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.
- -encoding character-encoding
-
Specifies the character encoding of the Java source to be input.
For character encoding that can be specified in Cosminexus XML Processor, see 1.3.2 Character encodings that can be processed.
If omitted, depending on the OS in use, the operations will differ as follows:
- In Windows
-
The default character encoding for the OS is applied.
- In UNIX
-
The character encoding specified in the environment variable LANG is applied. Even if the environment variable LANG is not specified, the default character encoding for the OS is applied.
(4) Input Java source
You can specify one Java source file. 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 schema document
Output as file name scheman.xsd (n is a numeric character) in the current directory or directory specified in the -d option. If a file with the same name exists in the output destination directory, then that file will be overwritten.
(6) Intermediate file
-
The csmschemagen command is used to compile the Java source file, and generate the .class file that is the intermediate file.
-
If the Java source file contains the package statement, create a subdirectory under the output destination directory, and then output the .class file. The subdirectory name is determined based on the package name specified in the package statement.
-
If the Java source file does not contain the package statement, output the .class file immediately under the output destination directory.
-
The output destination directory of the .class file can be changed with the -d option.
(7) Return value
- 0:
-
Normal termination.
- Value other than 0:
-
Abnormal termination.
(8) Notes
In Cosminexus 09-70 or later, when the csmschemagen command is executed, the schemagen command provided by Java SE 8 is executed.
However, use only the options supported by the csmschemagen command.
If invalid options are specified, the command might end with no error message displayed.
Note that if you use the command help, the help information for the schemagen command is displayed.
If you specify an uncompilable Java source file, the command ends with no error message displayed and no schema generated. Before executing the csmschemagen command, use the javac command to confirm that the target source files will not cause errors.