Hi
You can extract that id from the xml using xpath into a header
And then use that header in the fileName option for the file endpoint
Something alike this.
<setHeader headerName="someId"><xpath>/xxxx/yyyy/zzzz/text()</setHeader>
<to
uri="file:///data/outbound?fileName=item_splitted${header.someId}-${date:now:ddMMyyyy}.xml"/>
You may need to fiddle a bit with the xpath until it works.
On Wed, Aug 31, 2011 at 5:18 PM, kmute79 <[email protected]> wrote:
> Hi to all,
>
> I'd like to have a splitter that splits an xml file using xpath and save all
> the files named, one for every istance in the xpath expression.
>
> For example:
>
> my input xml is something like that
>
> <list-items>
> <item>......</item>
> <item>......</item>
> <item>......</item>
> </list-items>
>
>
> my camel split route is:
>
> <route id="splitter">
> <from uri="file:///data/inbound?noop=true" />
> <split parallelProcessing="true">
> <xpath>//item</xpath>
> <to
> uri="file:///data/outbound?fileName=item_splitted{id}-${date:now:ddMMyyyy}.xml"
> />
> </split>
> </route>
>
> wthat I like to have in the /data/outbound folder is a list of file one for
> all item tag in the input file named
> like that:
>
> item_splitted_1_30082011.xml
> item_splitted_2_30082011.xml
> item_splitted_3_30082011.xml
> ......
> and so on
>
> Thanks
>
> Matteo
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Splitter-file-name-automatic-generation-tp4754576p4754576.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
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/