If you are thinking to implement the solution with Smooks, I just refer some useful information from Smooks' Documentation:
Java to Text (XML, CSV, EDI etc)
As stated in other parts of this guide, the Smooks core runtime works
by processing a stream of SAX events produced by an input Source of
some type (XML, EDI, Java etc) and using those events to trigger
Visitor logic. In the case of a Java Source (see previous section on
"Java to Java"), Smooks uses XStream to generate this stream of SAX
events.
Sometimes, however, you just want to apply a template (e.g. a
FreeMarker template) to a Java Source object model and produce XML,
CSV, EDI etc. You don't want to incur the wasted overhead of
generating a stream of SAX events that you are not going to use. To do
this, you need to tell the Smooks core runtime to not generate the
stream of events. This can be done in one of 2 ways.
By calling setEventStreamRequired(false) on the JavaSource instance
being supplied to Smooks.filterSource:
JavaSource javaSource = new JavaSource(orderBean);
// Turn streaming off via the JavaSource...
javaSource.setEventStreamRequired(false);
smooks.filterSource(javaSource, result);
Or, by turning off the
"http://www.smooks.org/sax/features/generate-java-event-stream"
feature in the Smooks configuration:
<reader>
<features>
<setOff feature="http://www.smooks.org/sax/features/generate-java-event-stream" />
</features>
</reader>
<!-- Other Smooks configurations e.g. a FreeMarker template... -->
When applying the FreeMarker template, the name of the templating
context beans (i.e. the names used in your template) depends on the
Object type in the JavaSource:
If the object is a Map, then that Map instance becomes the templating
context and so you can just use the Map entry keys as the bean names
in your template. For non-Map objects, the JavaSource class takes the
Object Class SimpleName and creates a JavaBean property name from it.
This is the name of the context bean used for the templating. So, if
the bean class name is com.acme.Order, then the context bean name, for
the purpose of templating, will be "order".
Source: http://www.smooks.org/guide