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.