Showing posts with label Bindings File. Show all posts
Showing posts with label Bindings File. Show all posts

December 5, 2011

Reusing Generated JAXB Classes

In this post I will demonstrate how to leverage the -episode XJC extension to reuse classes previously generated from.an XML schema.  This is useful when an XML schema is imported by other XML schemas and you do not want the same classes generated each time.

August 25, 2011

XML Schema to Java - Generating XmlAdapters

In previous posts I have demonstrated how powerful JAXB's XmlAdapter can be when starting from domain objects.  In this example I will demonstrate how to leverage an XmlAdapter when generating an object model from an XML schema.  This post was inspired by an answer I gave to a question on Stack Overflow (feel free to up vote).

August 24, 2011

JAXB and Enums

Today I answered a question on Stack Overflow (feel free to up vote) about JAXB and generating Java enums from an XML Schema.  This is normally straight forward, but there are a couple "gotchas" to be aware of.  In this post I'll demonstrate an easy and a harder use case.

July 29, 2011

JAXB (XJC) and Nested Classes

Recently I came across a complaint on Twitter about how JAXB (XJC) generates deeply nested class structures from XML schemas.  In this post I want to first explain why JAXB does this, and second how to easily configure JAXB not to do this.

May 5, 2011

Schema to Java: @XmlMimeType & @XmlInlineBinaryData

In a previous post I described the impact of the @XmlInlineBinaryData and @XmlMimeType annotations in a JAX-WS environment where binary data may be sent as attachments.  One of the comments I received on that post was how to have those annotations generated onto your classes when starting from an XML schema.  In this post I will address that question.

April 15, 2011

XML Schema to Java - XSD Choice

In a previous blog post I wrote about how to map to the choice structure in XML schema when starting from classes.  An astute reader tried generating an object model from that schema and noticed that the JAXB implementation generated something different than expected.  In this post I'll explain the difference.

January 25, 2011

JAXB and Choosing the List Implementation

For elements with max occurs greater than one, JAXB will generate a java.util.List property and the underlying implementation will be java.util.ArrayList.  You can control which list implementation is used through internal and external schema annotations.  You can also use your own domain objects which gives you full control of your object model.  This post will discuss these different options.