Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-RC-1
-
None
Description
def doc = """ <agora-collection name="docstrct"> <element-list> <element name="18PP-ParlReg2" root="yes" > <name xml:lang="en">Item 1</name> </element> <element name="18PP-HPHC" root="yes" > <name xml:lang="en">Item 2</name> </element> <element name="Something else" root="yes" > <name xml:lang="en">Item 3</name> </element> </element-list> </agora-collection> """ docstruct = new XmlSlurper().parseText( doc) all18PPTopLevelElements = docstruct['element-list'].element.findAll() { it.@name.text().startsWith('18PP-') && (it.@name.text().count('-') == 1) } all18PPTopLevelElements.each() { println it }
This outputs:
========
Item 1
Item 2
null
========