Skip to content

Instantly share code, notes, and snippets.

@james-prickett
Created June 3, 2014 22:13
Show Gist options
  • Select an option

  • Save james-prickett/aa83ca6c0cbc181983a9 to your computer and use it in GitHub Desktop.

Select an option

Save james-prickett/aa83ca6c0cbc181983a9 to your computer and use it in GitHub Desktop.
Groovy XmlSlurper Example
def person = new XmlSlurper().parse("/home/james/person.xml")
assert person.name == "John Doe"
assert person.phone == "555-5555"
assert person.address[0].street == "5 Somewhere Lane"
assert person.address.find { it.@type.text().contains("home") }.street == "5 Somewhere Lane"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment