How I can find all elements in XML by their tag name in Groovy (GPath)?
I need to find all car elements in this document:
car
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*/