Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def persons = new XmlSlurper().parseText(xml)
- def firstnames = persons.person.firstname
- assert firstnames.collect {it.text()} == ['Eddard','Tyrion', 'Robb', 'Daenerys']
- def lastnames = persons.person.lastname
- assert lastnames.collect {it.text()} == ['Stark', 'Lannister', 'Stark', 'Targaryen']
- assert persons.'*'.find{it.@id.toInteger() == 3}.firstname == 'Robb'
Advertisement
Add Comment
Please, Sign In to add comment