jQuery的XML与包含标记解析:

问题描述:

我有一个XML响应,其中该节点是imx:IMX,当我使用jQuery来获得这个标签,我得到下面的错误的一些attribsjQuery的XML与包含标记解析:

Syntax error, unrecognized expression: IMX 
[Break On This Error] throw new Error("Syntax error, unrecognized expression: " + msg); in jquery_v1.7.1.js (line 4179) 

我的XML

<client> 
    <product> 
     <nodemetadata> 
      <imx:IMX xmlns:imx="http://com.abc.imx" > 
       <domainservice:GatewayNodeConfig imx:id="U:pgwr9B9HEeGgJbC99YpLSQ" consolePort="21963" consoleShutdownPort="21613" domainName="D_1158162131" nodeName="N_1158162131" dbConnectivity="ID_1"> 
        <address imx:id="ID_2" xsi:type="common:NodeAddress" host="panther" httpPort="21961" port="21962"/> 
        <portals> 
        <NodeRef imx:id="ID_3" xsi:type="common:NodeRef" address="ID_2" nodeName="N_1158162131"/> 
        </portals> 
       </domainservice:GatewayNodeConfig> 
       <domainservice:DBConnectivity imx:id="ID_1" dbEncryptedPassword="AfaFnEtrQMxkOEWRSFCQAQ%3D%3D" dbHost="fortnox" dbName="ORCL" dbPort="1521" dbType="ORACLE" dbUsername="mangla"/> 
      </imx:IMX> 
     </nodemetadata> 
    </product> 
</client> 

我的代码

$(xml).find('product').each(function(){ 
    $(this).children('nodemetadata').each(function(){ 
     $(this).children('imx:IMX').each(function(){ 
      $(this).children('domainservice:GatewayNodeConfig').each(function(){ 
       alert($(this).attr('domainName')); 
      }); 
     }); 
    }); 
}); 
+1

可能重复[jQuery的XML名称空间解析](http://*.com/questions/853740/jquery-xml-parsing-with-namespaces) –

饰演Felix克林已经指出..使用\\你的性格逃逸

如:

$(this).children('imx\\:IMX').each(function(){