How to find all XML elements by tag name in Groovy?
Use an XMLSlurper
def records = new XmlSlurper().parseText(file)records.depthFirst().findAll { !it.childNodes() && it.car} /*Otherwise this returns the values for parent nodes as well*/
Use an XMLSlurper
def records = new XmlSlurper().parseText(file)records.depthFirst().findAll { !it.childNodes() && it.car} /*Otherwise this returns the values for parent nodes as well*/