Read and edit local xml-file in Javascript
Look at the documentation for XMLHttpRequest.
Here is the documentation for the property you are reading:
XMLHttpRequest.responseXML Read only
Returns a Document containing the response to the request, or null if the request was unsuccessful, has not yet been sent, or cannot be parsed as XML or HTML. Not available in workers.
Now look around. Just three entries earlier it says:
XMLHttpRequest.responseText Read only
Returns a DOMString that contains the response to the request as text, or null if the request was unsuccessful or has not yet been sent.
So use that instead.
That said, XML is a structured data format with some fairly complex rules and it you should use DOM to edit it and not string manipulation (which is error prone and much more likely to result in invalid XML in your output).