Before you start
JiBX is a tool for binding XML data to Java™ objects. JiBX data binding has long been known as the fastest and most flexible approach for binding Java code to XML. But the complexity of its binding definitions and its limited support for increasingly widely used XML schema definitions have frustrated users at times. Fortunately, the 1.2 version of JiBX goes a long way toward eliminating these issues. In this tutorial, you'll learn about using the new features of JiBX 1.2 to generate Java code easily from XML schema definitions and to read and write XML documents matching the generated schema definitions — all without needing to get into the details of JiBX binding definitions. Part 1 covers the flip side of starting from Java code and generating XML schema definitions.
This tutorial guides you through the process of using JiBX to generate Java code from XML schema definitions. You'll first learn how to work with a simple schema and generate a default Java data model matching that schema, then use that data model for reading and writing XML documents. You'll next see how customizations can be used to modify the code generation so it better fits your needs. Finally, you'll move on to a more complex industry-standard schema example and explore the power of customizations to simplify the data model generated for that schema and improve usability. After reading this tutorial and working through the supplied examples, you'll be able to use JiBX to generate customized Java data models for your own schemas.
To understand this tutorial, you should have at least a basic knowledge of both Java code and XML. You don't need a detailed understanding of XML schema definitions, but some familiarity with schema will help you understand the examples better.
To run the examples you need to install:
- A recent version of the Apache Ant build tool.
JiBX download and installation instructions are included in the tutorial.