I am trying to read some local XML files with XMLHttpRequest() method, however some RSS files are 'malformed' with problems like "Opening and ending tag mismatch" (and obviouslly I can't fix then).
When open this LOCAL '.XML' files in browser or with xmlHttp.open("GET",url,true);
I got this response:
This page contains the following errors: error on line 6 at column 8: Opening >and ending tag mismatch: hr line 0 and body Below is a rendering of the page up to the first error. 301 Moved Permanently 301 Moved Permanently nginx/1.10.3
And than the 'original' code has just gone... If I open this files as .txt or .html I can see/get the content, but can't get xmlHttp.responseXml to parse it later. If I open then in original (external) URL everything is OK.
I tried force the response to be parsed as XML using xmlHttp.overrideMimeType('text/xml');
with no success.
The code I use is
function readxml(url){
xmlHttp = new window.XMLHttpRequest();
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
xmlDoc = xmlHttp.responseXML.documentElement;
return xmlDoc;
}
Any help in how can I just ''bypass'' this XML validation before I get file content?
` without matching end tags. – kjhughes Apr 12 '19 at 01:04
301 Moved Permanently