groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject Re: Issue with XML Serialization
Date Thu, 18 Aug 2016 11:04:11 GMT
wrt: XmlUtil.serialize(xml.toString())

You are seeing the expected behavior. If you look at the javadoc for
XmlNodePrinter, you'll see it does take a String parameter but it
expects that to be in xml format. If you take a look at the XmlParser
nodes, you'll see that they don't print out in xml. Just try "println

You're earlier code runs fine for me. I am not sure where the error
message is coming from. XmlUtil.serialize does indeed use
XmlNodePrinter and sets preserveWhiteSpace but that should work fine.
It almost looks like you have a mixture of jars from different Groovy
versions or are compiling with one version and running with another.
Can you add the following line to your script and see what output you

println getClass().classLoader.rootLoader.URLs

Cheers, Paul.

On Thu, Aug 18, 2016 at 8:57 PM, Paul King <> wrote:
> ---------- Forwarded message ----------
> From: GroovyBeginner <>
> Date: Thu, Aug 18, 2016 at 8:17 PM
> Subject: Issue with XML Serialization
> To:
> Am facing the issue when serialising the node object. Here is my code
> but getting an error groovy.util.XmlNodePrinter.setPreserveWhitespace(Z)V
> and when used  getting an
> --
> View this message in context:
> Sent from the Groovy Dev mailing list archive at

View raw message