读书人

jquery读取解析当地XML

发布时间: 2012-09-14 23:00:49 作者: rapoo

jquery读取解析本地XML

/**

读取本地XML

add by sufj 2011-8-31

*/

/*兼容ie,ff,chrome*/

function loadXmlFile(xmlFile){

? ?var xmlDom = null;

? ?if (window.ActiveXObject){

? xmlDom = new ActiveXObject('MSXML2.DOMDocument.3.0');

? xmlDom.async=false;

? xmlDom.load(xmlFile);

? ?}else if (document.implementation && document.implementation.createDocument){

? var xmlhttp = new window.XMLHttpRequest();

? xmlhttp.open("GET", xmlFile, false);

? xmlhttp.send(null);

? xmlDom = xmlhttp.responseXML;

? ?}else{

xmlDom = null;

? ?}

? ?return xmlDom;

}

读书人网 >XML SOAP

热点推荐