One Star

XML to XML mapping in Talend.

Hi,
I have to map one xml format to another.
The input XML is a response from a system.
Input XML:
<Inq>
<AcctId>
<AcctId></AcctId>
<AcctCurr></AcctCurr>
<AcctId>
<AcctBal>
<BalType>CLRBAL</BalType>
<BalAmt>
<amountValue></amountValue>
<currencyCode></currencyCode>
</BalAmt>
</AcctBal>
<AcctBal>
<BalType></BalType>
<BalAmt>
<amountValue></amountValue>
<currencyCode></currencyCode>
</BalAmt>
</AcctBal>
<AcctBal>
<BalType></BalType>
<BalAmt>
<amountValue></amountValue>
<currencyCode></currencyCode>
</BalAmt>
</AcctBal>
<Inq>
Output:
<Content>
<AcctId>
<AcctId></AcctId>
<AcctCurr></AcctCurr>
</AcctId>
<AcctBal>
<BalType></BalType>
<BalAmt>
<amountValue></amountValue>
<currencyCode></currencyCode>
</BalAmt>
</AcctBal>
<BalType></BalType>
<BalAmt>
<amountValue></amountValue>
<currencyCode></currencyCode>
</BalAmt>
</AcctBal>
</Content>
There are some loop elements involved in this. I tried doing this with tFileInputXML and tWriteXMLFiled.
In tFileInputXML there is no way to mard a element as Loop element hence in the schema it comes as a simple element.
Hence I am not able to map it as a loop element.
But only first element is getting mapped and other elements are lost.
Kindly let me know how to achieve this in Talend.
1 REPLY
Community Manager

Re: XML to XML mapping in Talend.

Hi
From your demo file, I see there is only one loop element AcctBal, set the xpath loop expression as /Inq/AcctBal, and then you are able to extract all values.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business