Improve pattern quality through custom transformations between the Java data model and XML documents
The XML schema definition is the basis for many types of data interchange, including most Web service forms. But XML schemas are a very complex standard, and most of the tools used to create and modify schema definitions are less functional and ease-of-use than the tools that work with Java™ code. You'll learn about the new features of JiBX 1.2 in part 1th of this tutorial-a two-part series-that will allow you to start with Java code and easily generate good schema definitions to match data structures. Then, whether you use JiBX data binding or not, you can use these patterns directly.
Before you start
About this tutorial
JiBX is the binding tool for XML data and Java objects. JiBX data binding has long been considered the fastest and most flexible way to bind Java code and XML. However, the complexity of its binding definitions and limited support for widely used XML schema definitions often disappoint users. Fortunately, the 1.2 version of JiBX has been working to eliminate these problems. In this tutorial, you will learn how to use the new features of the JIBX 1.2 to easily generate XML Schema definitions from existing Java code and to read and write XML documents that match the generated schema definitions-all of which do not require a detailed understanding of the JIBX binding definition. Part 2nd will introduce the opposite side, where Java code is generated from the XML schema definition.
Goal
This tutorial will guide you through the process of using JiBX to generate XML schema definitions from Java code. You'll first see how to start with a simple Java data model, and then generate a default pattern that matches the model. On this basis, you will learn how to easily control the actual values used by Java classes and their access methods by applying a series of customizations, and whether these classes are necessary or optional, the names and namespaces used in XML, and even the structure of the generated schema definition. In this process, you will see how JiBX uses the automated archiving pattern you have in Javadoc to define, making the generated schemas more valuable. After reading this tutorial and practicing the examples provided, you will be able to use JiBX to generate excellent XML schema definitions from your own Java data structure classes.
Prerequisite
To understand this tutorial, you should at least understand the basics of Java code and XML. You do not need to understand the XML schema definition in detail, but a slightly familiar pattern will help you better understand the example.
System Requirements
To run the sample, you need to install:
Any one of the following tools:
Sun ' s JDK 1.5.0_09 (or later).
IBM Developer Kit for Java technology 1.5.0 SR3.
The latest version of the Apache Ant build tool.
This tutorial includes the JiBX download and installation instructions.
Begin
In this section, you will have a preliminary understanding of Jibx and install the JIBX and tutorial sample code.