Extract delimited varying values from field and map to xml

One Star

Extract delimited varying values from field and map to xml

I've got a csv-input and want to map this to a xml structure output. So far, so simple, so good...
The input (a csv) looks like this:
12345;Longtitle 1;Shorttitle 2;dummy1 dummy2 dummy3;this is the first product
78901;Another product; other product;dummy8 dummy9;this is the second product
My problem is the "keyword" part. As this is "dynamic" i've got no idea how to extract these values from this field and map them to my xml.
The xml output should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<root><product><id>12345</id><title><type>long</type><text>Longtitle 1</text></title><title><type>short</type><text>Shorttitle 2</text></title><keyword><text>dummy1</text></keyword><keyword><text>dummy2</text></keyword><keyword><text>dummy3</text></keyword><description>this is the first product</description></product></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><product><id>78901</id><title><type>long</type><text>Another product</text></title><title><type>short</type><text> other product</text></title><keyword><text>dummy8</text></keyword><keyword><text>dummy9</text></keyword><description>this is the second product</description></product></root>
Can anyone guide me to a sample or something else? Or provide a solution for this small sample?
Thx in advance

Re: Extract delimited varying values from field and map to xml

Did you check the output components TalendHelpCenter:tFileOutputXML and tAdvancedFileOutputXML.
Best regards
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Extract delimited varying values from field and map to xml

Hi Sabrina,
thanks for your answer.
No, i didn't checked this components (not really, just a little bit). The output should go (in real world) to a tRESTClient...
As i'm relativ new to TOS, i have no clue how to extract the delimited values in the keywords field and pass them to my xml to look like that:
My Problem is, that the number of values to be extracted from the keywords-field is varying. From a simple view it's like an own delimited "stream" to be extracted in several "rows" and pass every "row" as <keyword>xxxx</keyword> to my xml-structure to get the result like mentioned above.

Hope i have clearly described where my problem is. Btw, how the solution would look like with the tFileOutputXml / tAdvancedFileOutputXML?
Best regards
One Star

Re: Extract delimited varying values from field and map to xml

OK, finally after some hours of try and error (and learning by doing) i figured out how to get the expected result.
tNormalize on the keywords field and use of a tXMLMap with proper setting of loop (on keyword) and aggregate (on id) will do the job in this sample.
I'll post the pictures showing the job as soon as i've solved some other problems and i've got time to.


Talend named a Leader.

Get your copy


Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables


How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration


Downloads and Trials

Test drive Talend's enterprise products.