Here is an example of updating XML using XmlSlurper:
Feb 08, 2008
For me, with groovy1.5 these two lines had to be changed (to put single quotes around the attribute names on assignment):
p.@quantity = (p.@quantity.toInteger() + 2).toString()
p.@when = 'Urgent'
p.'@quantity' = (p.@quantity.toInteger() + 2).toString()
p.'@when' = 'Urgent'
in order to not give this exception:
groovy.lang.MissingFieldException: No such field: quantity for class: groovy.util.slurpersupport.NodeChild
Powered by a free Atlassian Confluence Open Source Project License granted to Codehaus. Evaluate Confluence today.