I think you can use the camel-jaxb[1] to marsh the Object into XML and then you camel-xslt[2] to transform it. But it could be more easy to write a DataFormat[3] to go through the MyObject filed and build the XML yourself.
[1]http://camel.apache.org/jaxb.html [2]http://camel.apache.org/xslt.html [3]http://camel.apache.org/custom-dataformat.html -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, February 19, 2013 at 4:37 AM, Joe San wrote: > Camel Users, > > I have a scenario wherein I need to convert a message that I get from the > Camel exchange (MyObject.java) to an XML representation. The XML looks like > this: > > <NVBuilder> > <Builder> > <Name>SomeString</Name> > <Value>SomeValue</Value> > </Builder> > <Builder> > <Name>SomeString</Name> > <Value>SomeValue</Value> > </Builder> > <Builder> > <Name>SomeString</Name> > <Value>SomeValue</Value> > </Builder> > ..... > ..... > </NVBuilder> > > The Name and Value will be populated from the MyObject.java. The NVBuilder > does not have any XSD. But one thing that I know for sure is that the Name > fields are predefined. For example., there may be name fields like userId, > age, sex and so on. But in my Java Object (MyObject.java), the fields will > be userIdentification, gender and so on. > > Now I need to map the fields in MyObject.java to the corresponding fields > in NVBuilder.xml with the appropriate values for those fields. > > Any idea on how to leverage camel for the above scenario? > > Regards, > Joe > > Regards, > Joe