+

Search Tips   |   Advanced Search

schemagen command for JAXB applications


Use the schema generator tool, schemagen, to generate an XML schema using Java Architecture for XML Binding (JAXB).

Use JAXB APIs and tools to establish mappings between an XML schema and Java classes. XML schemas describe the data elements and relationships in an XML document. After a data mapping or binding exists, we can convert XML documents to and from Java objects. We can now access data stored in an XML document without the need to understand the data structure.

We can generate a schema file from Java classes using the schemagen schema generator tool to create the XML schema. After the mapping between XML schema and Java classes exists, XML instance documents can be converted to and from Java objects through the use of the JAXB binding runtime API. The resulting Java classes contain all the necessary information that the JAXB run time requires to parse the XML for marshaling and unmarshaling. Use the JAXB classes within Java API for XML Web Services (JAX-WS) applications or in the non-JAX-WS Java applications for processing XML data.

Supported configurations: The wsimport, wsgen, schemagen and xjc command-line tools are not supported on the z/OS platform. This functionality is provided by the assembly tools provided with WAS running on the z/OS platform. Read about these command-line tools for JAX-WS applications to learn more about these tools.

Best practice: WebSphere provides JAX-WS and JAXB tooling. The wsimport, wsgen, schemagen and xjc command-line tools are located in...

APP_ROOT\bin\

Similar tooling is provided by the Java SE Development Kit (JDK) 6. For the most part, artifacts generated by both the tooling provided with WebSphere and the JDK are the same. In general, artifacts generated by the JDK tools are portable across compliant runtime environments. However, it is a best practice to use the WebSphere tools to achieve seamless integration within the WebSphere environment. bprac

Avoid trouble: When running the schemagen tool, the schema generator does not correctly read the @XmlSchema annotations from the package-info class file to derive targetNamespaces. Instead of using the @XMLSchema annotation, use one of the following methods:

 

Syntax

The command line syntax is:

(Windows)

APP_ROOT\bin\schemagen.bat [options] <java_files>

[AIX] [HP-UX] [Linux] [Solaris]

APP_ROOT/bin/schemagen.sh [options] <java_files>

 

Parameters

The following parameters are optional for the schemagen command:

-classpath <path>

Location of the Java source or class files.

-cp <path>

Location of the Java source or class files.

-d <path>

Specifies where to place the processor and the generated Java class files.

-episode<file_name>

Specifies to generate an episode file for separate compilation.

-help

Display the help menu.

-version

Prints the version information. If we specify this option, only the version information is output and typical command processing does not occur.




Related concepts


Assembly tools

 

Related tasks


Use JAXB for XML data binding

 

Related information


Web services specifications and APIs