Suppose I have a node I\'d like to replace with replaceNode, however, I don\'t want to use a Builder to do it - or rather, I already have the node
replaceNode
Builder
If you don't mind switching to XmlSlurper() the following should work:
def top = new XmlSlurper().parse('input.xml') top.middle.each { node -> node.replaceNode { mkp.yield(new XmlSlurper().parse('replacement.xml')) } }
Which will replace all middle nodes with the contents of replacement.xml