I get extra line feeds on my mac when running identical code. Does anybody know 
why this would be?

On Linux… (expected output)

[tauser02@cfmips01ld0s work]$ groovy -v
Groovy Version: 4.0.10 JVM: 1.8.0_362 Vendor: Red Hat, Inc. OS: Linux
[tauser02@cfmips01ld0s work]$ cat test.groovy
String xml = $/<?xml version="1.0" encoding="UTF-8"?><root><elem1 
attr1="value1" attr2="value2"/><elem2 attr1="value4" attr2="value4"/></root>/$
def doc = new groovy.xml.XmlParser().parseText(xml)
println groovy.xml.XmlUtil.serialize(doc)
[tauser02@cfmips01ld0s work]$ groovy test.groovy
<?xml version="1.0" encoding="UTF-8"?><root>
<elem1 attr1="value1" attr2="value2"/>
<elem2 attr1="value4" attr2="value4"/>
</root>



On my MAC…(note extra line feeds output)


en032339@C02CJMZ8MD6M ~ % groovy -v

Groovy Version: 4.0.10 JVM: 18.0.2.1 Vendor: Eclipse Adoptium OS: Mac OS X

en032339@C02CJMZ8MD6M ~ % cat test.groovy

String xml = $/<?xml version="1.0" encoding="UTF-8"?><root><elem1 
attr1="value1" attr2="value2"/><elem2 attr1="value4" attr2="value4"/></root>/$

def doc = new groovy.xml.XmlParser().parseText(xml)

println groovy.xml.XmlUtil.serialize(doc)

en032339@C02CJMZ8MD6M ~ % groovy test.groovy

<?xml version="1.0" encoding="UTF-8"?><root>



  <elem1 attr1="value1" attr2="value2"/>



  <elem2 attr1="value4" attr2="value4"/>



</root>

Reply via email to