One Star

How to use cSplitter to split a string with XML tags

Hi,
I have a route that dequeues a message from ActiveMQ. After dequeueing the message (String with XML tags), I would like to split the message and store values from certain tags in context variables but I am finding it difficult to use cSplitter to achieve what I want and the only Talend cSplitter example online didn't help much. Please see my cSplitter setup and a smaller version of the string I would like to split.
My string:
<?xml version="1.0" encoding="UTF-8"?>
<root><AuditKey>42</AuditKey><Submission><CRMId>{00080000-0000-0000-0000-000000000000}</CRMId><Owner>String</Owner><Client>String</Client><Price><TDM>Aviation</TDM><Product>Screw</Product></Price></Submission></root>


Thank you
1 REPLY
One Star

Re: How to use cSplitter to split a string with XML tags

SHUJLTESB
A splitter is not made to do what you want , it's doesn't extract values but splits xml message who contain multiple instances of object (xml tag). For example:
<items>
<item></item>
<item></item>
<item></item>
</items>
In this example you will split each /items/item (using xpath). But you don't extract any value.
Ref: http://camel.apache.org/splitter.html
What do you mean by splitting the message?
Btw, you should use Headers instead of context variables.