Skip to main content

skip to main content

developerWorks  >  Java technology | XML | Open source  >

JiBX 1.2, Part 1: Java code to XML schema

Improve schema quality with custom conversion of Java data models to and from XML documents

developerWorks
Go to the previous pagePage 2 of 11 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
188 KB (29 pages)

Get Adobe® Reader®

Sample code


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


Getting started

In this section, you'll get an overview of JiBX, and you'll install JiBX and the tutorial sample code.

Introducing JiBX

JiBX is one of many tools used for converting between Java data structures and XML documents (see Resources). What sets JiBX apart from the others are performance and flexibility features. JiBX performance consistently measures at the top end of the range, surpassing that of other common tools (such as JAXB 2.0) by a factor or two or more. JiBX is also more flexible than almost all other Java-XML tools, using binding definitions to decouple the Java structure from the XML representation so that each can be changed independently of the other.

With the 1.2 release, JiBX adds major features supporting XML schema definitions. You can use tools included in the JiBX release to generate a schema definition matching your Java code or to generate Java code matching your schema definition. Either way, you also get a binding definition that lets you use JiBX to convert between the Java code and XML documents matching the schema definition. In this tutorial, you'll see how to apply the first type of generation: going from Java code to a schema definition.

Installing JiBX

You need to install JiBX before proceeding with this tutorial. Download the latest 1.2.x distribution ZIP and expand it to a convenient location on your system. You'll end up with a directory named jibx, which contains all the JiBX JARs, documentation, examples, and even the source code.

Installing the tutorial code

Now download the tutorial sample code, also provided as a ZIP file. The easiest way to install it on your system is to expand the ZIP into the root directory of your JiBX distribution (or on Windows®, copy the dwcode1 directory from inside the ZIP file to the root directory of your JiBX distribution). This should create a dwcode1 subdirectory in the jibx directory, with the example files (including build.xml, custom1.xml, and others) inside that dwcode1 subdirectory.

The sample code includes an Apache Ant build file to automate running the JiBX tools and handle the other steps involved in the examples. If you install the sample code directly into the JiBX installation directory, the build can access the JiBX JARs without any additional configuration. If you install the sample code elsewhere, you can still use the Ant build. In this case, you just need to set a JIBX_HOME environmental variable to the path to your JiBX installation. Alternatively, you can edit the build.xml file inside the sample-code directory and uncomment the line near the top of the file that sets the jibx-home property directly.



Back to top



Go to the previous pagePage 2 of 11 Go to the next page