Simple 2.4 - Java XML Serialization
Join the DZone community and get the full member experience.Join For Free
Simple is an XML configuration and serialization framework for Java. It provides an annotated approach to XML serialization that offers full object graph serialization and deserialization for Android, Google App Engine, and Java 1.5+.
This contains various changes to constructor injection for better matching and also introduces a very useful new annotation called @Path. This path takes a single value, which is an XPath expression defining the location of either an attribute or element. For example
@Path("path/to/element") private String value;
Which produces a wrapper such as
<path> <to> <element> ...
This is fully backward compatible and can be used with any of the element annotations and also the attribute annotation. This allows an otherwise flat object definition to be mapped in to a more complex XML structure. Such mappings reduce the number of object definitions required and also improves the frameworks XML binding capabilities. For some examples, see the tutorial.
Opinions expressed by DZone contributors are their own.