- 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:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK8FLazbaFawHC9LpbM0a6Ko29BznpWnDjDCsEFVirejrTru1Uhy4KlfuqFNQGE_apHN2YXWVJu_rr8T20b4RJm5BEMVq2A1fJApO2xB3zYrQLVEIgXrp0gq6Ec4SjZMDA1LQS/s320/folder.jpg)
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:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkY3lsboieu47-xLrFee3SjKdqdIB_N1gA1qSPKhKL8EnYrKcjwtmhEGt9XEb3k0tcfCxaEe9z8EFFGf8FKB2xvCWmEmpVJgM8muac7R0fpyt4P04fvLk4ylc5BzCaFPiIjjLg/s400/ota.jpg)
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:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBi95U5nmYUExpSlwkEnNJVA5kkkH-16x_-dQFbtpm1tHlDcdew4vc-BNz0kzpeoc7GK1HHaPJ0pOtRulSy5KyrvDybfA4xpPqO93mO7xG13QYPu8s1h_XCpSf9cTofCBVJMVR/s400/jaxb.jpg)
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!
![](file:///tmp/moz-screenshot.jpg)