javscript处理XML DOM(待续)
1、加载并解析XML文件
function loadXMLFile(url){
var xmldoc
if(window.ActiveXObject){
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
}else if(window.implementation){
xmldoc = document.implementation.createDocument("","",null);
}
xmldoc.async = false;
xml.load(url);
}
2、加载并解析XML字符串
function loadXMLString(text){
var xmldoc;
if(window.ActiveXObject){
xmldoc = new ActiveXObject('Microsoft.XMLDOM');
xmldoc.async = false;
xmldoc.loadXML(text);
}else if(window.DOMParser){
xmldoc = (new DOMParser()).parseFromString(text,'text/xml');
}
}