Hi See Bindy, and then you can annotate the bindy model class with JAXB annotations, and then convert to XML. http://camel.apache.org/bindy
Jonathan's article has an example showing this. http://java.dzone.com/articles/open-source-integration-apache On Wed, May 16, 2012 at 9:55 PM, ambarish.d <[email protected]> wrote: > Hello, > > I want to convert a CSV file to XML file in proper format. I have following > code which is doing the Job but output is not a expected one. > > context.addRoutes(new RouteBuilder() { > public void configure() { > from("file://TEST?fileName=ArticleDistribution.csv"). > unmarshal(). > csv(). > marshal(). > xstream(). > to("file://TESTOUT?fileName=ArticleDistribution.XML"); > } > }); > > For Example: > My CSV File looks like this: > > Name, Age, Sex, Zip > Edward, 22,M,33639 > Ema,27,F,30330 > > Output of Above code is: > > <list> > <java.util.Arrays_-ArrayList> > > <string>Name</string> > <string>Age</string> > <string>Sex</string> > <string>Zip</string> > > </java.util.Arrays_-ArrayList> > <java.util.Arrays_-ArrayList> > > <string>Edward</string> > <string> 22</string> > <string>M</string> > <string>33639</string> > > </java.util.Arrays_-ArrayList> > .. > </List> > > But Output I want is > > <List> > <data> > <Name>Edward</Name> > <Age>22</Age> > <Sex>M</Sex> > <Zip>33639</Zip> > </data> > <data> > .... > </data> > </List> > > Can anybody please help me and show the proper way of doing this. It will be > a great help. > > thanks > Amby > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Converting-CSV-to-XML-tp5711086.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
