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.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download