mamar
12 years agoContributor
[Resolved] How to fetch specific element values
Hi,
I have a below response from my test. Here i need to find and fetch all the amount values from the element <CompositeCurAmtType> having value as "TranTotal" only. Can anyone help me on how to get though groovy. (From the below response, i need only $10.00 and $77.00).
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<com.fnf:LoanAcctTrnRec xmlns:com.fnf="http://www.fnf.com/xes">
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>TranTotal</CompositeCurAmtType>
<CurAmt>
<Amt>10.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>CalcRunningPrincipalBal</CompositeCurAmtType>
<CurAmt>
<Amt>20.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>Fees/Charges</CompositeCurAmtType>
<CurAmt>
<Amt>30.25</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>TranTotal</CompositeCurAmtType>
<CurAmt>
<Amt>77.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>CalcRunningPrincipalBal</CompositeCurAmtType>
<CurAmt>
<Amt>46.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>Fees/Charges</CompositeCurAmtType>
<CurAmt>
<Amt>85.25</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
</com.fnf:LoanAcctTrnRec>
</soapenv:Body>
</soapenv:Envelope>
I have a below response from my test. Here i need to find and fetch all the amount values from the element <CompositeCurAmtType> having value as "TranTotal" only. Can anyone help me on how to get though groovy. (From the below response, i need only $10.00 and $77.00).
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<com.fnf:LoanAcctTrnRec xmlns:com.fnf="http://www.fnf.com/xes">
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>TranTotal</CompositeCurAmtType>
<CurAmt>
<Amt>10.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>CalcRunningPrincipalBal</CompositeCurAmtType>
<CurAmt>
<Amt>20.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>Fees/Charges</CompositeCurAmtType>
<CurAmt>
<Amt>30.25</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>TranTotal</CompositeCurAmtType>
<CurAmt>
<Amt>77.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>CalcRunningPrincipalBal</CompositeCurAmtType>
<CurAmt>
<Amt>46.00</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
<CompositeCurAmt xmlns="http://www.ifxforum.org/IFX_150">
<CompositeCurAmtType>Fees/Charges</CompositeCurAmtType>
<CurAmt>
<Amt>85.25</Amt>
<CurCode>USD</CurCode>
</CurAmt>
</CompositeCurAmt>
</com.fnf:LoanAcctTrnRec>
</soapenv:Body>
</soapenv:Envelope>