繁体   English   中英

在Internet Explorer上解析XML文档

[英]Parse xml doc on internet explorer

我想解析一个xml文档。 以下是代码段:

//Following is on receiving the xml doc  
self.xmlHttpReq.onreadystatechange = function()  
{
  if(self.xmlHttpReq.readyState == 4 && self.xmlHttpReq.status == 200)
  {
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
      xmlDoc = self.xmlHttpReq.responseText;
      var reqst = new RegExp("<d0>0"); //This could only get binary value  
      //How to parse in IE??  

     }
     else  // Moz, Chrome  
     {
       xmlDoc = self.xmlHttpReq.responseXML;  
       xmldat1 = xmlDoc.getElementsByTagName('d0')[0].firstChild.nodeValue;  
       xmldat2 = xmlDoc.getElementsByTagName('d1')[0].firstChild.nodeValue;  
     }
  }  

上面的解析对于mozilla和chrome很好,但是对于IE,我该如何解析?
注意:我不能使用任何jquery技术。

解析IE5和IE6时,需要设置以下特定行:

xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

检查此链接:

http://www.w3schools.com/xml/xml_parser.asp

这可以帮助您更好地理解。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM