1

javascript xpath API を使用してアトム フィードを解析したい:

<feed xmlns="http://www.w3.org/2005/Atom">
   <category scheme="http://app.link.com/schemes" type="types"/>
   <link rel="app" href="http://app.link.com"/>
  <entry>
   <link rel="appnn" href="http://app.link.internal"/>
  </entry>  
</feed>

javascript xPath API を使用してリンク属性を取得しようとしました。これは私が試したことです:

 var urlvar = '/feed/link/@href';
 var feed = xDoc.evaluate(urlvar, xDoc, null,XPathResult.STRING_TYPE, null);

しかし、結果はnullです

feed.stringValue 何が間違っていますか?

アップデート:

私は試した

function feedNSResolver(prefix) {
  return "http://www.w3.org/2005/Atom";
 }

運がなければ。

4

0 に答える 0