I have a xml response in which the node is imx:IMX
, when I use jquery to get some attribs of this tag i get the below error
我有一个xml响应,其中节点是imx:IMX,当我使用jquery获取此标记的某些属性时,我得到以下错误
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)
My XML
我的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>
My code
我的代码
$(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 个解决方案
#1
1
As Felix Kling has already pointed.. use \\
as your escaping character
正如Felix Kling已经指出的那样..使用\\作为逃避角色
eg:
例如:
$(this).children('imx\\:IMX').each(function(){
#1
1
As Felix Kling has already pointed.. use \\
as your escaping character
正如Felix Kling已经指出的那样..使用\\作为逃避角色
eg:
例如:
$(this).children('imx\\:IMX').each(function(){