Rather than rewriting the entire contents of an xml file when a single element is updated, is there a better alternative to updating the file?
If possible, serialize the XML and use diff/patch/apply Linux tools (or equivalent tools in your platform) . This way, you don't have to deal with parsing, writing.