-
1. Re: How to Transform Java to XML with Smooks
tcunning Feb 27, 2013 10:34 AM (in response to smartgridder)This thread has a really good example with lots of links to the right places in the Smooks documentation :
-
2. Re: How to Transform Java to XML with Smooks
smartgridder Feb 28, 2013 9:10 AM (in response to tcunning)Hey Tom,
thank you very much for your reply! I read that thread and it was helpful but i still don't understand the applyOnElement tag.
So far i created a data-model with hash maps and i would like to use my FreeMarker template when my HashMap with the key "acknowledge" is present.
My smooks-comfig.xml looks like this:
{code:xml}
<?xml version="1.0" encoding='UTF-8'?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd"
xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd">
<core:filterSettings type="SAX" defaultSerialization="true"/>
<resource-config selector="acknowledge">
<resource>org.milyn.delivery.DomModelCreator</resource>
</resource-config>
<ftl:freemarker applyOnElement="acknowledge">
<ftl:template>
<!--
<sg:Acknowledge xmlns:sg="urn:http://monitoring.service.esb.soa.jboss.smartgrid">
<sg:MessageType>${acknowledge.messageType}</sg:MessageType>
</sg:Acknowledge>
-->
</ftl:template>
</ftl:freemarker>
</smooks-resource-list>
{code}
My intention is, that the applyOnElement would trigger on that...but unfortunatly it doesn't.
The result after the transformation is this:
{code:xml}
<map>
<entry>
<string>acknowledge</string>
<map>
<entry>
<string>messageType</string>
<string>MeasurementPost</string>
</entry>
</map>
</entry>
<entry>
<string>PTIME</string>
<org.milyn.javabean.context.preinstalled.Time>
<startMillis>1362057406847</startMillis>
<startNanos>20428606624685</startNanos>
</org.milyn.javabean.context.preinstalled.Time>
</entry>
<entry>
<string>PUUID</string>
<org.milyn.javabean.context.preinstalled.UniqueID />
</entry>
</map>
{code}
any suggestions to that? i would appreciate it!
greetings
-
3. Re: How to Transform Java to XML with Smooks
smartgridder Mar 5, 2013 3:43 AM (in response to smartgridder)please help! anyone?!
-
4. Re: How to Transform Java to XML with Smooks
smartgridder Mar 7, 2013 8:32 AM (in response to smartgridder)Hey folks,
i have solved the problem in another thread: