- First, since the schema is so large, there are a few places where there are duplicate element names.
- Second, since the schema was not developed with jaxb in mind, there are a few element names (such as 'class') that are not legal in java.
After a few quick steps, the schema tool is ready to go:
1. Download the schema(s) that you want to use from opentravel.org and drop it in the ota-schema-zip-files directory:
2. Edit the ota.xsd file in the ota-schema-tools/config/2008A directory to include only the schema you will need (or leave it alone to compile all the schema). For example, here I only want to use the OTA_Ping messages:
3. Run the schema tool:
If jaxb is not in your classpath, you will need to tell ant where it is with the -Djaxb.home=/location-of-jaxb-home flag. Also, if you are compiling a lot of schemas, you will have to set the ANT_OPTS=javac-options property. Here is what I type:
ota-schema-tools> export ANT_OPTS=-Xmx512m ota-schema-tools> ant -Djaxb.home=/usr/local/java/web/glassfish/ dist
When I run this command I get the error: OTA_TourInformation.xsd and OTA_RailAvailRS.xsd is not a part of this compilation.
No problem. The jaxb configuration file is set up to fix problems in the entire schema. Just remove these lines from the ota-schema-tools/config/2008A/jaxb/binding.xjb file:
I deleted these highlighted lines. Now run this line again from your command prompt:
ant -Djaxb.home=/usr/local/java/web/glassfish/ dist
Voila! Your schema are compiled and neatly packaged in a opentravel2008a.jar file.
Now that wasn't that hard, was it!