You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "muneeb.ifkaar" <mu...@gmail.com> on 2012/09/06 11:14:06 UTC

how to convert xml inti csv file?

Hello all - I'm new to camel. i want read xml file from some folder and
convert it into .csv formate and save to other directory. Here is my route
which I define for it. But it doesn't work for me.

from("file:input?fileName=test.xml&noop=true").marshall().csv().to("file:output?fileName=outPut.csv");

please tell me what's wrong with this route. I neither receive any error nor
my desired output.  



--
View this message in context: http://camel.465427.n5.nabble.com/how-to-convert-xml-inti-csv-file-tp5718703.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to convert xml inti csv file?

Posted by Naveen Raj <na...@gmail.com>.
hi,

     If your input is xml then you need to use unmarshall to convert the xml
to objects.

If that is the case you are trying use unmarshall instead of marshall 

Regards,
Naveen



--
View this message in context: http://camel.465427.n5.nabble.com/how-to-convert-xml-inti-csv-file-tp5718703p5719077.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to convert xml inti csv file?

Posted by Christian Müller <ch...@gmail.com>.
You have multiple possibilities. The "right" choice (if its exist) depends
on your skills, constraints, ...

First, you could use XSLT to transform the XML into CVS. Have a look at the
Camel xslt component how it works [1].

I would choose a different approach. I would use the camel-jaxb data format
[2] to unmarshall the XML into a bean. Than use a bean/processor [3]/[4] to
map the (XML) bean into another (CVS) bean. Now you can use camel-csv [5],
camel-beanio [6] or camel-bindy [7] to generate the CSV.

[1] http://camel.apache.org/xslt.html
[2] http://camel.apache.org/jaxb.html
[3] http://camel.apache.org/bean.html
[4] http://camel.apache.org/processor.html
[5] http://camel.apache.org/csv.html
[6] http://camel.apache.org/beanio.html
[7] http://camel.apache.org/bindy.html

Best,
Christian

On Thu, Sep 6, 2012 at 11:14 AM, muneeb.ifkaar <mu...@gmail.com>wrote:

> Hello all - I'm new to camel. i want read xml file from some folder and
> convert it into .csv formate and save to other directory. Here is my route
> which I define for it. But it doesn't work for me.
>
>
> from("file:input?fileName=test.xml&noop=true").marshall().csv().to("file:output?fileName=outPut.csv");
>
> please tell me what's wrong with this route. I neither receive any error
> nor
> my desired output.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/how-to-convert-xml-inti-csv-file-tp5718703.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--