Modifying arbitrary XML files

Is there a generic task / plugin / feature that I can use to work with XML files, much like the android plugin modifies the manifest?

My goal is to be able to turn a collection of SVG files into PNGs using ImageMagick. Along the way, I want to be able to:

  • read an attribute into a property that I can then use in further gradle steps (so I can add a custom attribute to the SVG to identify the “natural” dimensions so I can scale accordingly * change text in the SVG (so I can add the current build version to a launch screen image)

I know I could do this with my own XML parsing and whatnot. Text parsing isn’t that novel and neither is XML parsing (I imagine I could start here, but I don’t want to build something from scratch if someone has already built it.

Any ideas?

There are no built-in tasks for generic XML file manipulation. I would probably suggest just using Groovy’s ‘XmlSlurper’ or ‘XmlParser’. Alternatively you could use Ant’s XSLT task.