Schema Generator

The schema generator tool first reads one or more JiBX binding definitions and then uses reflection to interpret the structure of the Java classes referenced in the bindings. By combining the binding definitions with the actual class information the schema generator is able to construct one or more XML schemas to represent the documents handled by the bindings.

The main limitation of the schema generator relates to handling of collections. If a binding does not specify the type of items included in a collection (which is allowed by JiBX, as long as the items are all object types with <mapping> definitions in the binding) the schema generator has no way of knowing the actual item type. It handles this situation by adding a comment in the generated schema which describes the unknown component of the binding. You can inspect the generated schema and replace any comments of this type with the appropriate schema definitions.

Another limitation relates to custom marshaller/unmarshallers. The schema generator does not have information about the XML structures used by custom marshaller/unmarshallers, so any references to these in the binding definition are left out of the schema. Instead, the schema generator again adds a comment to the generated schema describing the unknown component of the binding.

You can see an example of using the schema generator, and find out about the schema generator options, in the other pages of this section.