Thank you for the information.
Hope this is what you are looking for, click the link to quickly execute and see the output
http://groovyconsole.appspot.com/script/5167211400396800
//Closure to show the BM node details def showBM = { BM, index -> println "Detail of BM node ${index}" BM.with { println "A : ${A}" println "V : ${V}" println "VC : ${VC}" println "VCP : ${VCP}" println "W : ${W}" } } def xml = '''<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:GDR xmlns:ns2="URL" xmlns:ns3="URL"> <PAM> <TP> <A>MSFT</A> <V>9316.84</V> <VC>-177.12</VC> <VCP>-1.87</VCP> <W>3.5</W> </TP> <TP> <A>AAPL</A> <V>8517.75</V> <VC>567.75</VC> <VCP>7.14</VCP> <W>3.2</W> </TP> <TP> <A>GOOG</A> <V>6942.69</V> <VC>20.88</VC> <VCP>0.3</VCP> <W>2.61</W> </TP> <BM> <A>MCK</A> <V>824.00</V> <VC>-91.15</VC> <VCP>-9.96</VCP> <W>0.3</W> </BM> <BM> <A>OXY</A> <V>5005.50</V> <VC>-521.14</VC> <VCP>-9.43</VCP> <W>1.88</W> </BM> <BM> <A>FANG</A> <V>1678.65</V> <VC>-154.85</VC> <VCP>-8.45</VCP> <W>0.63</W> </BM> </PAM> </ns2:GDR> </soap:Body> </soap:Envelope>''' def envelope = new XmlSlurper().parseText(xml) def bms = envelope.'**'.findAll {it.name() == 'BM'} println "Size of the BM list is ${bms.size()}" bms.eachWithIndex { BM, id -> showBM(BM, id+1) }
Note: if you want to see the output in soapui, then you need to replace "println" with "log.info". Other wise, it will be shown in soapui.log file.