You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/04/27 08:34:00 UTC
[jira] [Closed] (GROOVY-10495) Invalid newlines generated by XmlTemplateEngine
[ https://issues.apache.org/jira/browse/GROOVY-10495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10495.
------------------------------
> 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
> Assignee: Paul King
> Priority: Major
> Fix For: 5.0.0-alpha-1, 3.0.11, 4.0.2
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> 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.7#820007)