How to generate XML containing siblings of the group element

One Star

How to generate XML containing siblings of the group element

I want to generate the following xml using tWriteXMLField.

 

 

<SetDocument>
<Key>pass123</Key>
<CostCenterID>41004</CostCenterID>
<Owner>Admin</Owner>
<Header>
<DocPrefix></DocPrefix>
<DocNo></DocNo>
<CustomerName>
<Code>4102</Code>
<Name></Name>
</CustomerName>
<VehicleNo>
<Code>2</Code>
<Name></Name>
</VehicleNo>
<Branch>
<Code>11</Code>
<Name></Name>
</Branch>
</Header>
<Body>
<Row>
<ProductCode>
<Code>D05</Code>
<Name></Name>
</ProductCode>
<Qty>1</Qty>
<Units>
<Code>Kg</Code>
<Name></Name>
</Units>
<UnitPrice>1</UnitPrice>
<RefNO>9393</RefNO>
</Row>
<Row>
<ProductCode>
<Code>D06</Code>
<Name></Name>
</ProductCode>
<Qty>1</Qty>
<Units>
<Code>Kg</Code>
<Name></Name>
</Units>
<UnitPrice>1</UnitPrice>
<RefNO>9394</RefNO>
</Row>
</Body>
</SetDocument>

/Body/Row is the loop element. <SetDocument> is the root element and for this to work, should be the group element as well but I learned I cannot mark the root element as group element.

 

I am willing to try another component. How can I get this working. I am using Talend Open Studio. 

 

Moderator

Re: How to generate XML containing siblings of the group element

Hello,

What does your input source data look like?

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