Starting from schemaGenerating Java code and binding definitions from XML schema definitions is easy with JiBX. The CodeGen tool, added in the 1.2 release, allows you to use both automatic and customized generation for your XML schemas. It provides some very useful features for generating clean code, including:
If you compare the data models generated by CodeGen with other Java code generation
from schema tools you'll see some significant differences, especially when it comes to
schema features like xs:choice and xs:attributeGroup/xs:group. Most other Java code
generation tools basically ignore xs:choice and leave it to the developer to understand
that they can only set one of the alternatives. CodeGen optionally supports this approach
(using the For an in-depth look at using CodeGen, see the JiBX 1.2, Part 2: XML schema to Java code tutorial on the IBM developerWorks site. You can also look over the CodeGen examples included in the distribution, which are discussed in this section of the documentation. This section of the documentation currently covers only CodeGen. In the future web services code generation directly from WSDL will be supported, and this section will be expanded to include information on the tool used for that purpose. |