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

XMLBuilder makes broken XML if data contains &

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-beta-6
    • 1.0-beta-10
    • None
    • None

    Description

      data = ['Rod': ['Misha':'a & b', 'Bowie':2], 'Eric': ['Poe':4, 'Doc':3]]
      xml = new groovy.xml.MarkupBuilder()
      people = xml.people(){
      for(entry in data){
      person(name: entry.key){
      for (dog in entry.value)

      { pet(name:dog.key, age:dog.value) }

      }
      }
      }

      produces:

      <people>
      <person name='Rod'>
      <pet name='Bowie' age='2' />
      <pet name='Misha' age='a & b' />
      </person>
      <person name='Eric'>
      <pet name='Poe' age='4' />
      <pet name='Doc' age='3' />
      </person>
      </people>

      which is broken xml

      Attachments

        Activity

          People

            sstirling sstirling
            bahrus Bruce Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: