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

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.

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 GARNER 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

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

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download