i have a xml from where i wish to remove few nodes. The idea i used is to run through all the root node children and keep writing to another file those nodes which i dont need to delete.
One problem I see is: the node attributes gets reordered in the written file which i dont want
my code looks like:
def xml = new XmlSlurper(false, false).parse(args[0])
ant.delete(file:fileName)
File f = new File(fileName)
xml.children().each{
String str = it.@name
if(some condiotion == false)
f << groovy.xml.XmlUtil.serialize(it)
}
another problem is that in the begining of every node it inserts
<?xml version="1.0" encoding="UTF-8"?>