Skip to content

Instantly share code, notes, and snippets.

@shenie
Created November 26, 2010 05:30
Show Gist options
  • Save shenie/716310 to your computer and use it in GitHub Desktop.
Save shenie/716310 to your computer and use it in GitHub Desktop.
public String convertToString(GPathResult doc) {
def defaultNamespace = doc.lookupNamespace('')
if (defaultNamespace) {
def docWithNamespace = {
mkp.declareNamespace("": defaultNamespace)
out << doc
}
return new StreamingMarkupBuilder().bind(docWithNamespace)
} else {
return XmlUtil.serialize(doc as GPathResult)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment