Skip to main content

JAXB 2.0 Early Draft 2

Posted by sekhar on March 24, 2005 at 11:53 AM EST

JAXB 2.0 Early Draft 2

JAXB 2.0 (JSR222) Early Draft 2 is now available for review. Early Draft 2 contains both a specification as well as javadocs. Both are downloadable from JSR 222 JCP JAXB site . We have added significant functionality. We are very interested in your feedback.

Here is a highlight of some of the features: XML schema support, Java to XML Schema mapping, schema evolution and portability.

XML Schema support

We have added support for the following XML Schema constructs:

  • wildcard attribute
  • wildcard
  • redefine
  • notation
  • type substitution of complex types
  • element substitution

So this draft version covers the binding of all of the XML Schema features. JAXB 1.0 specification contained a list of schema features that were not required to be supported in section E.2, "Not Required XML Schema concepts". In Early Draft 2, you will notice that we have removed this section completely ! We are continuing to work on flushing out some details, but the binding now covers all of XML Schema features.

Another notable new feature is the binding of schema components to value classes. Binding to value classes has several advantages. It cuts down on the number of classes generated and also allows users to create schema-derived instances with "new" instead of requiring creation using factory method.

For ease of development, we have leveraged J2SE 5.0 features:

  • generics for type safe collections
  • enum type for binding of simple type with enumeration facets
  • better support for XML schema types using datatypes in JAXP 1.3
  • leveraging JAXP 1.3 validation for smaller footprint
  • more compact binding based on constraining facets defined in schema

Java To XML Schema mapping

Java to XML Schema mapping has been one of the major goals of JAXB 2.0. The mapping is customizable using annotations. In the first JAXB 2.0 ED, we defined a set of annotations for this purpose. In this draft, we have added and/or improved the annotations to provide additional mapping capabilities:

  • added ability to serialize a class by a field or a property by default.
  • redesigned support for mapping of non JavaBeans. Check out the new package java.xml.bind.annotation.adapters
  • added mapping of enum type
  • added mapping of classes to anonymous types
  • redesigned collections for ease of development

Schema evolution

We have also redesigned JAXB architecture to assist with schema evolution and invalid XML content. We have introduced a flexible unmarshalling mode that allows for unmarshalling of invalid XML content. Optional unmarshal time validation can be used by an application to detect invalid XML content and decide whether to terminate unmarshalling.

Portability

To enable writing of portable JAXB 2.0 applications, JAXB 2.0 architecture is now annotation driven. Classes written by users or generated from a schema, can be annotated with JAXB defined annotations. The latter provide the meta data for marshalling and unmarshalling to and from XML representation.

Feedback

The JSR 222 expert group would welcome your input on the current draft. There is lots of useful, good stuff in the draft. I think you will find the following particularly useful:

  • Chapter 1, "Introduction" for an introduction and JAXB 2.0 goals.
  • Chapter 3, "Architecture" for a high level overview of JAXB 2.0 architecture.
  • Section 8.2, "Overview" for an overview of annotations defined in the javax.xml.bind.annotation package.
  • javax.xml.bind package javadocs. Specifically, javax.xml.bind.annotation has extensive usage information as well as examples on annotations

You can send to comments to the email alias indicated on the title page of the JAXB 2.0 Early Draft 2.

Questions related to JAXB 2.0 can also be posted at JAXB 2.0 forum on java.net

This is part of our move to a more visible development model to enable us to get feedback sooner rather than later in the JAXB 2.0 development cycle. Additionally, going forward, we are planning to make intermediate drops of the JAXB 2.0 technlogy frequently. So watch the JAXB project on java.net for further information and announcements.

We are interested in your feedback. Let us know.

Related Topics >>