javascript - Error processing resource while parsing KML with '°' symbol in IE -
i trying parse kml file contains data degree symbol , ie cannot recognize symbol. need either replace degree symbol hash code or have escape character. have verified lot of links non of them worked 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(); // browsers } else if (!!window.activexobject) { xhrfetcher.fetcher = new window.activexobject('microsoft.xmlhttp'); // ie } } if (!xhrfetcher.fetcher) { geoxml3.log('unable 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 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 fetcher object geoxml3.fetchers.push(xhrfetcher); } }; xhrfetcher.xhrtimeout = settimeout(timeouthandler, geoxml3.xhrtimeout); xhrfetcher.fetcher.send(null); } };
this code using parse kml file. work fine in other browser not in ie
your kml invalid.
<description><b>chemical name:</b> hydrogen sulfide<br><b>wind:</b> 0.8 meters/second 180.0° true @ 3 meters<br></description>
this works me:
<description><b>chemical name:</b> hydrogen sulfide<br /><b>wind:</b> 0.8 meters/second 180.0° true @ 3 meters<br /></description>
Comments
Post a Comment