0
嘗試解析字符串中的XML時出現問題。我使用chrome,並且字符串由websocket寫入。 這是字符串中的XML:使用jQuery從字符串解析XML
<?xml version="1.0" encoding="iso-8859-1"?>
<event name="newchannel">
<privilege>call,all</privilege>
<channel>SIP/NTECH-00000008</channel>
<channelstate>0</channelstate>
<channelstatedesc>Down</channelstatedesc>
<calleridnum>0725922523</calleridnum>
<calleridname /> <accountcode />
<uniqueid>1305017047.8</uniqueid>
<actionid>1305017047_0_ALL_ALL</actionid>
</event>
,我試圖得到的數據是<calleridnum>0725922523</calleridnum>
。 使用此編號,將新行添加到DOM構建表(1行/新事件)中。
這是打印出一個新行jQuery的,但空:
var nrtel = $(afisare).find("calleridnum").text();
我試過其他的例子,但他們沒有打印出任何東西。
任何幫助將是偉大的。
感謝, 塞巴斯蒂安
編輯 我在Chrome控制檯
3642Uncaught Syntax error, unrecognized expression: (Presentation Allowed, Not Screened)</cid-callingpres>
<actionid>1305023821_0_ALL_ALL</actionid>
</event>
Sizzle.errorjquery-1.5.2.js:3642
Sizzle.filterjquery-1.5.2.js:3628
Sizzlejquery-1.5.2.js:3418
Sizzlejquery-1.5.2.js:4507
Sizzlejquery-1.5.2.js:3482
Sizzlejquery-1.5.2.js:4507
jQuery.fn.extend.findjquery-1.5.2.js:4747
jQuery.jQuery.fn.jQuery.initjquery-1.5.2.js:173
jQuery.jQueryjquery-1.5.2.js:25