Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在IE中使用jQuery$(this).text()读取Xml_Jquery - Fatal编程技术网

在IE中使用jQuery$(this).text()读取Xml

在IE中使用jQuery$(this).text()读取Xml,jquery,Jquery,我试图从XML中获取数据。我需要从父标记regstudio获取子parm数据 $(xml).find("regstudio").each(function() { $( $(this).text() ).find("parm").each(function(){ console.log($(this).text()); }); }); 此处$this.text在IE中不起作用 这里是我使用的XML: <regstudio> <![CDATA

我试图从XML中获取数据。我需要从父标记regstudio获取子parm数据

$(xml).find("regstudio").each(function() { 
    $( $(this).text() ).find("parm").each(function(){
        console.log($(this).text());
    });
});
此处$this.text在IE中不起作用

这里是我使用的XML:

<regstudio> 
<![CDATA[ 
 <config> 
   <control id="0"> 
    <parm name="PropPage">propRegPage</parm> 
    <parm name="PropTitle">Page</parm> 
    <parm name="RequiredMark">*</parm> 
    <parm name="ShowIfReged">F</parm> 
    <parm name="ShowIfNoReq">F</parm> 
   </control> 
  </config>  
]]> 
</regstudio>

根据文档,您需要使用解析xml,然后使用$..将其包装到jQuery对象中

所以你想要的是:

$($.parseXML(xml)).find("regstudio").each(function() { 
   ....
}

根据我的快速测试,这似乎适用于所有浏览器:

propRegPage Page*F]]>这是我试图从中获取值的XML。不要将其放入注释中,请在问题中正确设置格式,如中所示,以便可读。你是新来的,所以我帮了你一些忙。如果你花一点时间让你的问题可读,并且有大量的例子,你会更快地得到更好的答案。