Hello Robbin!

In your route, the second splitted message overrides the first file. You
must set an unique file name per splittet message (with a custom bean or a
peace of script code) - between the xpath and to definition.

Best,
Christian

Sent from a mobile device
Am 05.08.2011 20:42 schrieb "guitarcarver" <[email protected]>:
> Hello,
>
> I would like to send a set of temperature readings to a camel route using
> multiple XML nodes. And then split them into individual readings and deal
> with them one at a time. This is simplified, in the end I'll use
messaging.
>
> This is the route:
>
> <route>
> <from uri="file://temps.xml" />
> <split>
> <xpath>/Thermometer</xpath>
> <to uri="file://Temperatures" />
> </split>
> </route>
>
> Where temps.xml looks like this:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <Thermometer>
> <OneWireZoneName>hot water</OneWireZoneName>
> <address>10843F09000800C3</address>
> <OneWireType>DS18S20</OneWireType>
> <Value>115.812</Value>
> </Thermometer>
> <Thermometer>
> <OneWireZoneName>2nd floor heat</OneWireZoneName>
> <address>10AFA808000800E4</address>
> <OneWireType>DS18S20</OneWireType>
> <Value>85.1</Value>
> </Thermometer>
>
> The route produces a single file with the last reading (last 6 lines of
> temp.xml). I'd like it to produce 2 files, with one reading per file. I
> saw a similar posting called "XPath Splitter Problem" from April 22, 2010
> which discussed this. I have the same issue and I think I've followed the
> advice. I toyed with using a loop and changing the XPATH query to
> /Temperatures[$CamelLoopIndex] but I think split is what I really want.
>
> Why use XML? I hope if I add a data field, the XML-based code will still
> work whereas a CSV list might cause me positional data grief later.
>
> How can I (in DSL) split my concatenated XML file into many single
> thermometer files (hopefully without resorting to my own bean)?
>
> Robbin
> An old Fortran IV programmer, learning new tricks
>
> --
> View this message in context:
http://camel.465427.n5.nabble.com/xpath-splitter-returns-last-xml-node-tp4670473p4670473.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to