In a previous post I introduced how the @XmlAnyElement(lax=true) annotation could be used to create a very flexible mapping. In this post I'll dig a bit deeper into how it relates to both the @XmlRootElement and @XmlElementDecl.
Showing posts with label XmlAnyElement. Show all posts
Showing posts with label XmlAnyElement. Show all posts
December 21, 2012
JAXB's @XmlAnyElement(lax=true) Explained
Labels:
JAXB,
XmlAnyElement,
XmlElementDecl,
XmlRootElement
November 15, 2012
Creating a Generic List Wrapper in JAXB
To marshal/unmarshal a list with a JAXB (JSR-222) implementation you need to create a wrapper object to hold the list. People find this onerous having to create multiple wrapper objects for this purpose. Below I'll demonstrate that in reality you only need to create one. This post is based on an answer I gave on Stack Overflow.
Labels:
Collection Property,
JAXB,
XmlAnyElement,
XmlRootElement
February 11, 2012
Mapping an Arbitrary List of Objects using JAXB's @XmlAnyElement and XmlAdapter
The @XmlAnyElement annotation enables a property to handle arbitrary XML elements, and the XmlAdapter provides a way to convert an object that can not be mapped into one that can. In this post we will combine these two mechanisms to map a list of arbitrary objects.
This post will cover the following concepts:
This post will cover the following concepts:
- The @XmlAnyElement annotation
- A type level XmlAdapter
- Marshalling/Unmarshalling root level simple data types (i.e. String and Integer)
- Specifying a root element via JAXBElement
- Specifying the type to be unmarshalled on the Unmarshaller
April 15, 2011
@XmlAnyElement and non-DOM Properties
This post will cover how to use an alternate DOM representation (i.e. String) with @XmlAnyElement.
August 26, 2010
Using @XmlAnyElement to Build a Generic Message
In this post we are building our own XML messaging framework. We want to have a standard message object (similar to a SOAP envelope) that the framework can understand, and the ability to easily add domain specific payloads over time.
Subscribe to:
Posts (Atom)