Feeds

A practical guide to JAXB 2.0

Take a peek at its new features

  • alert
  • submit to reddit

5 things you didn’t know about cloud backup

The directory structure of the JAXB2 project is shown in Figure 2.

JAXB Project Directory Structure

Compiling an XML Schema

In this section, we will bind the catalog schema, catalog.xsd, to Java classes with the xjc compiler. We shall configure xjc as an external tool in Eclipse. Select Run>External Tools>External Tools. In the External Tools frame, right-click on the Program node and select New to create a new configuration as shown in Figure 3.  XJC External Tools Configuration

Also, set environment variables JAVA_HOME and JAXB_HOME in the external tool configuration for xjc in the Environment tab, as shown in Figure 4.

 Setting Environment Variables

Run xjc compiler on the example schema, catalog.xsd. Select catalog.xsd file in the Package Explorer window and then Run>External Tools>XJC.

The output from the XJC compiler is shown in Figure 5.

Output from XJC Compiler

Schema-derived classes get generated in the gen_source folder, as shown in Figure 6.

Schema Derived Classes

Java classes and interfaces are generated in package generated, by default. For each xsd:complexType schema component, one value class gets generated, instead of an interface and an implementation class. For example, for catalogType complexType a Java value class CatalogType.java gets generated. An ObjectFactory.java class also gets generated. The factory class consists of create methods to create Java value class objects.

Boost IT visibility and business value

More from The Register

next story
The Return of BSOD: Does ANYONE trust Microsoft patches?
Sysadmins, you're either fighting fires or seen as incompetents now
Linux turns 23 and Linus Torvalds celebrates as only he can
No, not with swearing, but by controlling the release cycle
China hopes home-grown OS will oust Microsoft
Doesn't much like Apple or Google, either
Sin COS to tan Windows? Chinese operating system to debut in autumn – report
Development alliance working on desktop, mobe software
Eat up Martha! Microsoft slings handwriting recog into OneNote on Android
Freehand input on non-Windows kit for the first time
Linux kernel devs made to finger their dongles before contributing code
Two-factor auth enabled for Kernel.org repositories
This is how I set about making a fortune with my own startup
Would you leave your well-paid job to chase your dream?
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Endpoint data privacy in the cloud is easier than you think
Innovations in encryption and storage resolve issues of data privacy and key requirements for companies to look for in a solution.
Scale data protection with your virtual environment
To scale at the rate of virtualization growth, data protection solutions need to adopt new capabilities and simplify current features.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?