GPath is a path expression language we've integrated into Groovy which is similar in aims and scope as XPath is to XML.
1. Expression language for tree structured data
2. Implementations for XML
3. Can specify a path to an element
a.b.c -> all the <c> elements inside <b> inside <a>
4. Can specify attributes
a"@href" -> the href attribute of all the a elements
Example
The best example of GPath for xml is test-new/groovy/util/XmlSlurperTest.groovy.
Error rendering macro 'code' : Invalid value specified for parameter lang
h3 References:
Getting Groovy with XML by Jack Herrington.
See some examples.
Labels