I'm trying to figure out how to modify an xml file at build time as part of my gradle war project. I see how to use the groovy XmlParser to do what I want, and I see that I can apply a groovy filter to the task, but the filters all seem to be designed around line-by-line processing.
Is there some way to read the whole xml file with XmlParser inside the context of a groovy filter?
gretty {
webappCopy {
// Add any prevoty definitions to web.xml
filesMatching 'WEB-INF/web.xml', { FileCopyDetails fileDetails ->
logger.warn 'web.xml filtered: {}', fileDetails.path
filter {
// WHAT GOES HERE???
}
}
}