i am trying to parse my kml file which contains the data with degree symbol and IE cannot recognize that symbol. So i need to either replace the degree symbol with its hash code or have to escape this character. i have verified a lot of links but non of them worked for me.`
geoXML3.fetchXML = function (url, callback) {
function timeoutHandler() {
geoXML3.log('XHR timeout');
callback();
};
var xhrFetcher = new Object();
if (!!geoXML3.fetchers.length) {
xhrFetcher = geoXML3.fetchers.pop();
} else {
if (!!window.XMLHttpRequest) {
xhrFetcher.fetcher = new window.XMLHttpRequest(); // Most browsers
} else if (!!window.ActiveXObject) {
xhrFetcher.fetcher = new window.ActiveXObject('Microsoft.XMLHTTP'); // Some IE
}
}
if (!xhrFetcher.fetcher) {
geoXML3.log('Unable to create XHR object');
callback(null);
} else {
xhrFetcher.fetcher.open('GET', url, true);
if (xhrFetcher.fetcher.overrideMimeType) {
xhrFetcher.fetcher.overrideMimeType('text/xml');
}
xhrFetcher.fetcher.onreadystatechange = function () {
if (xhrFetcher.fetcher.readyState === 4) {
// Retrieval complete
if (!!xhrFetcher.xhrtimeout)
clearTimeout(xhrFetcher.xhrtimeout);
if (xhrFetcher.fetcher.status >= 400) {
geoXML3.log('HTTP error ' + xhrFetcher.fetcher.status + ' retrieving ' + url);
callback();
} else {
// Returned successfully
var xml = geoXML3.xmlParse(xhrFetcher.fetcher.responseText);
if (xml.parseError && (xml.parseError.errorCode != 0)) {
geoXML3.log("XML parse error "+xml.parseError.errorCode+", "+xml.parseError.reason+"\nLine:"+xml.parseError.line+", Position:"+xml.parseError.linepos+", srcText:"+xml.parseError.srcText);
xml = "failed parse"
} else if (geoXML3.isParseError(xml)) {
geoXML3.log("XML parse error");
xml = "failed parse"
}
callback(xml);
}
// We're done with this fetcher object
geoXML3.fetchers.push(xhrFetcher);
}
};
xhrFetcher.xhrtimeout = setTimeout(timeoutHandler, geoXML3.xhrTimeout);
xhrFetcher.fetcher.send(null);
}
};
this is the code which i am using to parse my kml file. this work fine in other browser but not in IE
Your KML is invalid.
<description><b>Chemical Name:</b> HYDROGEN SULFIDE<br><b>Wind:</b> 0.8 meters/second from 180.0° true at 3 meters<br></description>
This works for me:
<description><b>Chemical Name:</b> HYDROGEN SULFIDE<br /><b>Wind:</b> 0.8 meters/second from 180.0° true at 3 meters<br /></description>