Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.
Labels (3)
1 Reply
Anonymous
Not applicable
Author

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
0683p000009MEiS.png