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'
to:
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
1 Comment
Hide/Show CommentsFeb 08, 2008
Lynn
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'
to:
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