Daniel Sun created GROOVY-10495:
-----------------------------------

             Summary: Invalid newlines generated by XmlTemplateEngine
                 Key: GROOVY-10495
                 URL: https://issues.apache.org/jira/browse/GROOVY-10495
             Project: Groovy
          Issue Type: Bug
            Reporter: Daniel Sun
             Fix For: 4.x


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

We expect the following test pass:
{code:java}
        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
{code}
But we get(see the newlines around {{{}Daniel{}}}):
{code:xml}
<person>
  <name>
    Daniel
  </name>
</person>

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



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to