Forum Discussion

zgh4693's avatar
zgh4693
Occasional Contributor
2 years ago

how to get xml joint value and output in groovy

i have a xml  '''<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://abc" > <Cool Type="abc" > </Cool> <Cool Type="abk" > <Line LineID="0" Main="1"> <Info updateDate="17-05-20...
  • nmrao's avatar
    2 years ago

    Please see if this is what you need?

     

     

     

    def xml = new XmlParser().parseText(str)
    def result = xml.'**'.findAll{it.@Type == 'abg'}
    result.each { cool ->
    	cool.'**'.findAll {it.@Tag == 'A'}.each {
    		log.info "Type = ${cool.@Type} and Tag = ${it.@Tag}"   	
    	}
    }