What happens if you do:
def inFile = file( 'file.xml' )
def xml = new XmlSlurper().parse( inFile )
xml.appendNode {
haha( 'tim_yates' )
}
inFile.withWriter { outWriter ->
XmlUtil.serialize( new StreamingMarkupBuilder().bind{ mkp.yield xml }, outWriter )
}
Is it just not written? (seems to work for me)