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
This is how it works:
def xml = new XmlSlurper().parse(file) def cars = xml.depthFirst().findAll { it.name() == 'car' } assert cars.size() == 2