解析xml.txt function parseXML(text){ var xmlDoc = null; try //Internet Explorer { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(text); } catch (e) { try //Firefox, Mozilla, Opera, etc. { parser = n
function parseXML(text){ var xmlDoc = null; try //Internet Explorer { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(text); } catch (e) { try //Firefox, Mozilla, Opera, etc. { parser = new DOMParser(); xmlDoc = parser.parseFromString(text, "text/xml"); } catch (e) { alert(e.message); return; } } return xmlDoc; } //该片段来自于http://www.codesnippet.cn/detail/1509201513688.html