Thanks! - I have extended the example to show four variations of this.
I my code I was creating a SAXParser pool to initialize the XmlSlurper with
because I was told it greatly reduce the time and overhead of instantiating
an XmlSlurper object from scratch.
Although, I thought I had tested with
OT
> “b:child2.b:content.b:dataNode”
>
>
>
> In order for this to work the XML has to be parsed with the XmlSlurper
> argument namespaceAware=true.
>
> def root = new XmlSlurper(false, true).parseText(xml)
>
>
>
> Now the println will show that the namespace
ialize(newRoot)
From: John Wagenleitner [mailto:john.wagenleit...@gmail.com]
Sent: Friday, April 15, 2016 2:18 PM
To: users@groovy.apache.org
Subject: Re: XmlSlurper Namespace Question
Are you doing more than just removing nodes? The following seems to retain the
namespace prefixes when seriali
Are you doing more than just removing nodes? The following seems to retain
the namespace prefixes when serializing back out after removing a node.
import groovy.xml.*
String xml = '''
child1
child2
child3
'''
def root = new XmlSlurper().parseText(xml)
root.child2.replaceNode {}