How to find element by attribute value in GPath?
What is an alternative to this XPath //div[@id='foo'] in GPath? In general, where I can find this documentation? Nicolas Modrzyk Here is the corresponding snippet: def node = new XmlSlurper().parseText(...) def foo = node.depthFirst().findAll { it.name() == 'div' && it.@id == 'foo'} A few other links you may want to read: GPath documentation Processing XML with Groovy The previous poster gave you all that's required: Assuming your document has been slurped into xml , you want def foo = xml.path.to.div.find{it.@id == 'foo'} to find a single result. Or findAll to find all results. To mimic the