From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

extract xml for each row

Highlighted
Six Stars

extract xml for each row

Hello,

 

In my data source I have records with XML content that I want to extract and duplicate rows :

Data Source 

id | content 

100 | <?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><Years>2018</Years><data>110</data></Item><Item><Years >2019</Years><data>200</data></Item></Items></RepeaterData>

 

I want to get an out put like  :

 

100 | 2018 | 110

100| 2019 | 200

 

which component could I use ? Any help please ?


Accepted Solutions
Highlighted
Nine Stars

Re: extract xml for each row

Please try below

 

XMLExtract.PNGXMLExtract1.PNG

 

Regards,

Veeru Boppudi

View solution in original post


All Replies
Highlighted
Moderator

Re: extract xml for each row

tExtractXMLField

Highlighted
Nine Stars

Re: extract xml for each row

Please try below

 

XMLExtract.PNGXMLExtract1.PNG

 

Regards,

Veeru Boppudi

View solution in original post

Highlighted
Six Stars

Re: extract xml for each row

Thank's for the solution !! Could you please show me the content of your tjavaRow ? 

when i set context.setProperty("ID", out.id); the value of the property is lost in the tExtractXMLfield

Highlighted
Four Stars

Re: extract xml for each row

tjavarow code will be like this :

 

context.id=input_row.id; -> Assigning the context value directly.
output_row.content = input_row.content;

 

Highlighted
Six Stars

Re: extract xml for each row

I don't knoy why with context variables I'm getting empty values .

I used GlobalMap and it work's.

thank you 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog