JiBX: Starting from Code

### Starting from Code

Generating binding definitions and XML schema definitions from Java code is easy with JiBX. The BindGen tool, added in the 1.2 release, allows you to use both automatic and customized conversions for your Java classes. It provides a much better feature set than any of the alternative ways to generate schema definitions from Java code, including:

- Export JavaDocs as schema documentation
- Support for both untyped and typed (Java 5) collection classes
- Support for both custom typesafe enumerations and Java 5 enums
- Easy control over attribute vs. element, required vs. optional
- Clean schema structure, with customizations for fine-grained control

For an in-depth look at using BindGen, see the JiBX 1.2, Part 1: Java code to XML schema tutorial on the IBM developerWorks site. You can also look over the BindGen examples included in the distribution, which are discussed in this section of the documentation.

Besides generating schema definitions, you can also generate WSDL definitions from Java code. This uses the Jibx2Wsdl tool. Jibx2Wsdl builds on BindGen's features for generating data structure schemas, while adding equally-attractive features for generating WSDL service descriptions.

This section of the documentation covers both BindGen and Jibx2Wsdl. It also includes information on the associated SchemaGen tool, which is primarily intended for use by BindGen and Jibx2Wsdl but can also be used directly.