JiBX 1.2, part 2nd: From XML Schema to Java code (i)

Source: Internet
Author: User
Tags bind continue new features require web services

Generate cleaner, custom Java code from XML schemas

The XML Schema Definition generation code is widely used for various types of XML data interchange, including WEB services. Most data-binding tools organize the generated code in strict accordance with patterns-even according to patterns that may not be relevant to the application. This tutorial is the second part of a two-part series that will explain how JiBX 1.2 generates cleaner code by better parsing patterns and eliminating unnecessary class clutter. You will also see how to customize the generated code to better meet your requirements, including the ease of eliminating the customization of unnecessary schema components.

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 Java code from an XML schema definition, 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 1th will introduce the opposite side, which is the generation of XML schema definitions from Java code.

Goal

This tutorial will guide you through the process of using JiBX to generate Java code from an XML schema definition. You'll first learn how to use simple patterns and generate a default Java data model that matches that pattern, and then use that data model to read and write XML documents. Next you'll see how you can use customizations to modify code generation to better meet your needs. Finally, you will continue to move to an example of a more complex industry-standard pattern and explore the strengths of customization to simplify the data model generated for that pattern and increase availability. After reading this tutorial and trying to use the examples provided, you will be able to use JiBX to generate a custom Java data model for your own schema.

The XML Schema Definition generation code is widely used for various types of XML data interchange, including WEB services. Most data-binding tools organize the generated code in strict accordance with patterns-even according to patterns that may not be relevant to the application. This tutorial is the second part of a two-part series that will explain how JiBX 1.2 generates cleaner code by better parsing patterns and eliminating unnecessary class clutter. You will also see how to customize the generated code to better meet your requirements, including the ease of eliminating the customization of unnecessary schema components.

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 Java code from an XML schema definition, 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 1th will introduce the opposite side, which is the generation of XML schema definitions from Java code.

Goal

This tutorial will guide you through the process of using JiBX to generate Java code from an XML schema definition. You'll first learn how to use simple patterns and generate a default Java data model that matches that pattern, and then use that data model to read and write XML documents. Next you'll see how you can use customizations to modify code generation to better meet your needs. Finally, you will continue to move to an example of a more complex industry-standard pattern and explore the strengths of customization to simplify the data model generated for that pattern and increase availability. After reading this tutorial and trying to use the examples provided, you will be able to use JiBX to generate a custom Java data model for your own schema.

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.