Skip to end of metadata
Go to start of metadata

Here is an example of updating XML using XmlSlurper:

  • No labels

1 Comment

  1. 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