I'm iterating through a VERY large REST api response in XML format. Every time I see a node called <TaxiCode>, for example, I want to save it's value to a variable (below I just print it out). The code below is just a snippet and does iterate through each node.
def doc = new XmlSlurper().parseText(xmlResponse)
doc.Itinerary.each { Itinerary ->
Itinerary.children().each { tag ->
if (${tag.name()} == "TaxiCode") {
println "${tag.name()}: ${tag.text()}"
}
...
I'm not sure how to format the if statement, very new to Groovy and I can't find any similar code.
I don't want to do an assert!
Any help appreciated.