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');
  } }

 

posted @ 2013-07-22 15:07  沙漠孤鹰1140  阅读(260)  评论(0编辑  收藏  举报