Reputation: 11
I want to get Tag =A what should i do?
def res = '''<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://abc" >
<Cool Type="abc" >
</Cool>
<Cool Type="abg" >
</Cool>
<Cool Type="abg" >
</Cool>
<Cool Type="abg" >
<Line LineID="0" Main="1">
<Info updateDate="17-05-2028" >
<Selection Tag="A" Status="Offer"/>
<Selection Tag="A" Status="Offer"/>
<Selection Tag="A" Status="Offer"/>
</Info>
</Line>
</Cool>
<Cool Type="abg" >
<Line LineID="0" Main="1">
<Info updateDate="17-05-2028" >
<Selection Tag="A" Status="Offer"/>
<Selection Tag="A" Status="Offer"/>
<Selection Tag="A" Status="Offer"/>
</Info>
</Line>
</Cool>
</SOAP-ENV:Envelope> '''
xml = new XmlParser().parseText(res)
results = xml.'**'.findAll { it.@Type == 'abg' }
results.each {
log.info(it.@Type)
}
expect output six Tag =A enter image description here
Upvotes: 0
Views: 89