2012-04-22 39 views
0

我想写一个RSS阅读器为metro风格,下面是我的应用程序中的一个函数。我无法在我的xml dom中找到selectSingleNode方法 - metro风格

function btnOKClick() { 
     var btnOK = document.getElementById("btnOK"); 
     var txtAddress = document.getElementById("rssAddress"); 
     WinJS.xhr({ url: txtAddress.value }).done(function (result) { 
      var xml = result.responseXML; 
      //xml.selectSingleNode(); 
    }); 

但我无法在我的xml变量中找到selectSingleNode方法。任何人都可以帮忙?

回答

0

显然,selectSingleNode方法是提供了通过消费者预览版,但后来辗转建立,因为作为Kraig Brockschmidt puts it

...的 request.responseXML的基本对象类型被改变,而且对象有它自己的API。 之前它是一个XML DOM对象(out of the MSXML library),但它被 改为HTML DOM对象,因此改变了方法和 属性。

In the same post,给人的Kraig到selectSingleNode新的替代:

你需要使用querySelector代替selectNodes ......这 现在应该是这样的:

var categories = request.responseXML.querySelectorAll("entry");