November 4, 2010

JAXB and Inheritance - Using the xsi:type Attribute

In a previous blog post I was challenged by an Xstream user to describe how JAXB handles inheritance.  In this post I'll describe one strategy that can be used, and how easily this can be done with JAXB.  I'll discuss alternate strategies in future posts.

October 25, 2010

How Does JAXB Compare to Simple?

In a previous post I compared JAXB to XStream.  In this post I'll run that comparison with the Simple XML Serialization framework.

October 21, 2010

JAXB and XSD Choice: @XmlElements

XML Schema has the concept of a choice element.  The choice element indicates that one of the elements defined within the choice may occur at this point in the XML document.  In this example I will demonstrate how easily this can be mapped using JAXB.

October 7, 2010

JAXB and Shared References: @XmlID and @XmlIDREF

When converting objects to XML, privately owned data can easily be represented through nested elements.  When there are multiple references to an object another mechanism needs to be used.  In JAXB this mechanism is @XmlID and @XmlIDREF.

October 6, 2010

How Does JAXB Compare to XStream?

The XStream FAQ states the following when being compared to JAXB:

JAXB is a Java binding tool. It generates Java code from a schema and you are able to transform from those classes into XML matching the processed schema and back. Note, that you cannot use your own objects, you have to use what is generated.
In this post I will provide an alternative answer to that question.

September 28, 2010

JAXB & Collection Properties

In this post will examine the different options JAXB offers for representing collections in XML.  We will look at the following annotations:
  • @XmlElement
  • @XmlElementWrapper
  • @XmlList
  • @XmlList and @XmlAttribute
  • @XmlList and @XmlValue

JAXB & XML Infoset Preservation

In this post we will discuss how to use JAXB to preserve the XML Infoset. 

September 13, 2010

XPath Based Mapping - Geocode Example

In a previous post I introduced MOXy's XPath based mapping JAXB extension.  In this post I'll use Google Maps Geocoding API V2 to demonstrate how powerful this extension is.

September 10, 2010

Processing Atom Feeds with SDO

Service Data Objects (SDO) is a Java standard (JSR-235) that can be used to process XML.  In this post we will compare SDO to JAXB by processing an Atom feed.

September 8, 2010

Processing Atom Feeds with JAXB

Atom is an XML format for representing web feeds.  A standard format allows reader applications to display feeds from different sources.  In this example we will process the Atom feed for this blog.