The Schema2Java ANT Task is for launching the Schema2Java command-line tool in Apache ANT. Schema2Java translates an XML Schema description of structures into Java classes. More detailed information is given in Schema2Java.
![]() | Note |
---|---|
Examples You can find usage examples of ANT tasks in WASP_HOME/src/example/tools/ant and in the build.xml files in Demos. See also Example 215 and Example 216. |
Task name | Task class |
---|---|
Schema2Java | com.idoox.wasp.tools.ant.Schema2JavaTask |
Example 215. Schema2Java ANT Task Using Attributes
<project name="test" default="main" basedir="."> <taskdef name="Schema2Java" classname="com.idoox.wasp.tools.ant.Schema2JavaTask"/> <target name="main"> <Schema2Java outputDirectory="../test_output" structurePackage="test.structure"> xmlSchemaURL="schema.xsd"/> </target> </project>
Example 216. Schema2Java ANT Task Using Sub-Elements
<?xml version="1.0" encoding="UTF-8"?> <project basedir="." default="main" name="test"> <taskdef classname="com.idoox.wasp.tools.ant.Schema2JavaTask" name="Schema2Java"/> <target name="main"> <Schema2Java outputDirectory="../test_output" structurePackage="test.structure"> <xmlSchema url="simpleSchema.xsd"/> <xmlSchema url="complexSchema.xsd"/> </Schema2Java> </target> </project>
Attribute Name | Description | Required | Command-line Option |
---|---|---|---|
deploymentDescriptor | Sets the deployment descriptor that describes additional XML schemas/type mapping to be used for processing the XML Schema document. When this option is used, processing must be used as well. | No | --deployment-descriptor |
processing | Sets the processing in the deployment descriptor that describes additional XML schemas/type mapping to be used for processing the XML Schema document. If this option is used, deploymentDescriptor must be used as well (see above). | No | --processing |
force | Overwrites existing file when a file with same path as the file being generated exists already. This prevents File already exists-type errors. (=true/false) | No | --force |
outputDirectory | Sets the directory where the output from the files will be stored. | No | --outputDirectory |
generateJavaBeans | If set to true, JavaBeans are generated instead of structures. | No | --generate-javabeans |
generateInterfaces | If set to true, structures are generated as interfaces. | No | --generate-interfaces |
mixedToDom | Map XML Schema types with mixed content to org.w3c.dom.Element. | No | --mixed-to-dom |
strictSchema | If set to true, no beautification is performed and the generated classes strictly follow XML schema. | No | --strict-schema |
structurePackage | Sets the name of the generated structures. | No | --structure-package |
verbose | Additional information during processing will be printed to stderr. Value is a level from 0-10. Default=0 | No | --verbose |
xmlSchemaURL | Sets the XML Schema file or URL to be used for output generation. | Yes | - |
Specifies the type mapping from a schema type named in the format {ns}local to a Java class.
Attribute of schema2java | Description |
---|---|
type | Name of the schema type in the format {ns}local, where ns is the namespace and local is the name of the schema type from that namespace. |
class | Fully qualified name of the Java class to which the schema type will be mapped |
Sets the XML Schema to be used for generating output.
Attribute of xmlSchema | Description | Required |
---|---|---|
url | Contains the file or URL of XML Schema which has to be used for output generation. | Yes |
Specifies mapping from schema namespace to java package. Example:
<Namespace2Package namespace="http://tempuri.org" package="org.tempuri" />
Attribute of namespace2package | Description |
---|---|
namespace | Source XML schema namespace |
package | Target Java package |