Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2234

XmlParser results are missing ability to set attribute values using assignment

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.1-rc-3
    • None
    • None
    • 1.1-rc-1

    Description

      A common groovy style is to allow setting of things using assignment. The groovy.util.Node objects, produced by XmlParser, have accessors which look like GPath with a little enhancement for attributes: the selector name must be quoted (but see issue http://jira.codehaus.org/browse/GROOVY-2233 ) and must start with an "@"; for example: xxx.subnode_name.'@attr_name'

      The part of the implementation that allows "setting" of these by using assignment is failing. Failing example:
      aNode.'@attrName' = 'new value'

      If the attribute is not already present, this gives a message "no field named attrName found, rather than doing the right thing of adding (or updating) that attribute.

      Attachments

        Activity

          People

            paulk Paul King
            schor Marshall Schor
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: