How to generate target XML file with multiple loops under same parent group element

Highlighted
Six Stars

How to generate target XML file with multiple loops under same parent group element

Hi,

 

Can some help me with below scenario

 

Need to apply multiple loops(Product,Discounts) within a group element (Product_History)

Sample target format

<Product_History>
<Product>
<product-id>1</product-id>
<product-name>soap</product-name>
<product-price>12</product-price>
<Discounts>
<Discount>
<Discount-id>Sample</Discount-id>
</Discount>
<Discount>
<Discount-id>ProUser</Discount-id>
</Discount>
</Discounts>
</Product>
<Product>
<product-id>2</product-id>
<product-name>chocolate</product-name>
<product-price>121</product-price>
<Discounts>
<Discount>
<Discount-id>ProUser</Discount-id>
</Discount>
</Discounts>
</Product>
<Product>
<product-id>3</product-id>
<product-name>car</product-name>
<product-price>23465412</product-price>
<Discounts>
<Discount>
<Discount-id>Luckywinner</Discount-id>
</Discount>
<Discount>
<Discount-id>ProUser</Discount-id>
</Discount>
<Discount>
<Discount-id>top10</Discount-id>
</Discount>
</Discounts>
</Product>

</Product_History>

 

 

Thanks in Advance.

Highlighted
Moderator

Re: How to generate target XML file with multiple loops under same parent group element

Hello,

What does your input source look like?

Could you please elaborate your case with an example with input values?

You can set group element by using tAdvancedFileOutPutXML component with the 'append the source xml file' feature.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

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 2

Part 2 of a series on Context Variables

Blog

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