FAQ
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.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupusers @
categoriescamel
postedAug 5, '11 at 6:42p
activeAug 5, '11 at 9:56p
posts2
users2
websitecamel.apache.org

2 users in discussion

Christian Müller: 1 post Guitarcarver: 1 post

People

Translate

site design / logo © 2022 Grokbase