Well, it doesnt always mean if it is a an xml file, we should either go for DOM or SAX. DOM consumes lot of your memory and increase code complexity. SAX as well will consume much of your brain to apply the patterns and matching. Both, DOM and SAX, apart from providing you a easy-to-handle interfaces, it involves reading the xml file into memory.
My point is buffer the file by yourself, and repeatedly apply your regular expressions to replace the strings, just a flat treatment, and write back the file, I belive it best suites your case, if you doesnt have to do much more processing on the generated xml which demands you to have a DOM or SAX of it.