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

Invalid newlines generated by XmlTemplateEngine

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.11, 4.0.2
    • None
    • None

    Description

      In our recent project, we found a formatting bug of XmlTemplateEngine:

      We expect the following test pass:

              XmlTemplateEngine xmlTemplateEngine = new XmlTemplateEngine();
              String xmlScript = "<person>\n"
                               + "  <name>Daniel</name>\n"
                               + "</person>";
              Template template = xmlTemplateEngine.createTemplate(xmlScript);
              assertTrue(template.make().toString().contains("<name>Daniel</name>")); // no newlines
      

      But we get(see the newlines around Daniel):

      <person>
        <name>
          Daniel
        </name>
      </person>
      
      

      As a result, we will get additional newlines if we parse the generated xml and fetch the text of name element.

      Attachments

        Activity

          People

            paulk Paul King
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m