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.

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.

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

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now