Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Not A Bug
-
Affects Version/s: 1.8.6
-
Fix Version/s: None
-
Component/s: XML Processing
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
text between elements ending with empty line or white spaces is trimmed. This is the test case that should pass:
import groovy.xml.* def xml = new XmlParser().parseText("<a>x \n\t </a>") assert "x \n\t " == xml.text()
Note, that XmlSlurper works fine:
import groovy.xml.* def xml = new XmlSlurper().parseText("<a>x \n\t </a>") assert "x \n\t " == xml.text()
For historical reasons, XmlParser defaults to trimming of element text. You probably want:
We may change the default in a future version of Groovy.