Thanks for the reply! To describe my case more precisely, in my Processor, I get the JAXB object:
MyObj obj = exchange.getIn().getBody(MyObj.class) obj has fields getOne, getTwo, getThree and so on.... I have to go through those fields and somehow map them to a target object. Some fields in the source Object MyObj map one to one to the target object, but some fields do not. For example, getThree in source object might be represented as get3 in the target object. It could also be that getThree in the source object is not relevant to the target object. How do I do such a mapping? Any idea? Regards, Jothi On Tue, Feb 19, 2013 at 3:49 AM, Willem jiang <willem.ji...@gmail.com>wrote: > 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 > > > >