0
我有一個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'));
});
});
});
});
可能重複[jQuery的XML名稱空間解析](http://stackoverflow.com/questions/853740/jquery-xml-parsing-with-namespaces) –