Editing an XML file in R and saving back to XML

I can't promise to take a crack at the problem after my recent nasty run-in with XML, but others, following the zen of lazy evaluation might, if you can provide a reproducible example, called a reprex.