我不確定如果我正在使用XPath表達式執行此操作。我正在嘗試在DOM上查找文本,並將此文本分配給一個變量。我有存儲在SQLite中的文本,並且我已經檢索了文本,並且正試圖在實際上包含文本的網頁上找到它。所以我ahve下面的代碼:XPath表達式異常
var searchText = dataset[x]['selectedText'];
alert(dataset[x]['selectedText']);
var res = googbar_frames[0].contentDocument.evaluate("//*[.=searchText]",googbar_frames[0].contentDocument.body,null,XPathResult.ANY_TYPE,null);
alert(res.snapshotLength);
而且我得到以下錯誤。
Error: Permission denied for <http://en.wikipedia.org> to call method XPathException.toString on <>.
Error: Permission denied for <http://en.wikipedia.org> to call method XPathException.toString on <>.
得到了正確的表達。我正在嘗試查找DOM上的文本。或者我會錯誤的somwehere? 歡呼
需要更多的代碼。什麼是googbar_frames?代碼從哪裏調用? – 2009-10-26 14:59:27