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

MarkupBuilder fails to escape entities in multi-line attributes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-6
    • 1.1-beta-3
    • XML Processing
    • None
    • Fedora core 3, JDK 1.5

    Description

      A single-line string used as an attribute is escaped by MarkupBuilder; a multi-line string isn't.

      For example:
      import groovy.xml.*
      MarkupBuilder builder = new MarkupBuilder()
      builder.test
      {
      def multi = '''
      Jon & Co
      '''
      def single = 'Jon & Co'
      inner (multi:multi, single:single)
      }

      produces:

      <test>
      <inner multi='
      Jon & Co
      ' single='Jon & Co' />
      </test>

      Attachments

        1. MultilineAttributeTest.groovy
          0.4 kB
          Jon Skeet

        Activity

          People

            paulk Paul King
            jskeet Jon Skeet
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: