X-O lite applicability

X-O lite solves the java Objects to XML mapping problem using an approach at the opposite of usual mapping tools: no schema-based tools, code instrumentation or generation but just plain java code and interfaces.

Of course, this approach does not fit well all the use cases. This document gives hints to evaluate if X-O lite is good for your project.

When does X-O lite pay off

Here are some guidelines to evaluate if using X-O lite will be a gain of a loss for your project.

use X-O lite if...Use other tool if...
The starting point is an OO model. The model exists (is implemented) before XML mapping.The starting point is an XML definition. The model is created for XML serialization.
You have few complex objects to serialize to XML.You have a lot of dump objects to serialize to XML.
The objects are also used for other purpose than XML support and have behavior (they contain code).The objects are just data holders.
The objects use different collection types (like sets, maps, BTrees ...) to hold data.The only collection used is List.
The objects uses inheritance, the same object can appear at several places in the object tree.No inheritance, no reuse of the same object?
The model is complex (it's a graph or a deep tree) or recursive.The model is flat.
The model can be extended.No extensions.
The model has a single 'natural' serialization to XMLThe same model must be serialized to totally different XML depending on the context.
Your XML schema contains uncommon features (like abstract types or substitution groups)Your XML schema contains only standards features (elements and types).
You have a different cardinality between objects, xml elements and xml types (like 2 different xml elements are mapped to the same object).Your schema defines one Xml type for one Xml element and the bindings maps it to one object.
You want to have fine control on both the object model and the XML (and schema) used to serialize it.You don't care about the exact model content and/or the XML used to serialize it.

If you are comparing several mapping tools, X-O lite can be a good comparison basis because it shows you what is the cost and the performance of a hand-made implementation that is almost bare SAX.

You should also mind the XML processing tool you might use to manipulate your XML (to make reports or graphical representation of your schemas, to use a XML database, to transform XMLs, to map web-services ...) with a special attention to those based on the schemas. X-O lite gives you freedom to use any XML schema construct but the tools you (or other parties) use might only support a subset of W3C XML schemas. This is not a real problem, you just have to keep it in mind when you write your schema to avoid unsupported features.

Not for Web services

Web services are a way exchange data or events between different systems. It means that the exchanged XMLs does not depend solely on your model but also on the needs of the other parties. The form and content of those XML are negotiated between parties (or imposed by one). As the XML evolution is driven by forces that you cannot control, it's better to minimize its links to your model.

The exchanged XMLs are also the least common denominator processing capabilities of all the parties. It means that you will be forbid to use special XML schema features. The XML schemas will probably be generated by some tool with no possibility to modify it. The generated schemas are usually quite dump with very poor reuse.

In fact, for usual Web services, all the items of the column "Use other tools" in the evaluation table applies. It means that, in general, this API is not well suited for Web Services implementation.

But good for...

If X-O lite is not suited for Web-service implementation, what is if good for?

I've successfully used it for:

  • XML Import/export of complex data model
  • XML configuration of home-made tools like workflows, application guis...

Follow your taste

Choosing a tool is also a matter of taste.

If you like dense java model (with inheritance, reuse, functionality encapsulated in the objects). If you use to write your XML schemas by hand to really make them structured with patterns following your model patterns (similar inheritance and composition as in java model). If you like to tune your XML so that they can easily be readable of writable by human beings ... then you will enjoy X-O lite.

If you want the tools to do the job, not wondering a lot about the content of the schemas and XML as long as they serve their purpose. If want your XML to use only most commonly accepted patterns so that they can be handled by any tool ... you better choose another API.