1

I want to parse an atom feed using 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>

I tried to get the link(s) attributes using the javascript xPath API. This is what I have tried:

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

But the result is null for

feed.stringValue What I am doing wrong?

Update:

I tried

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

without any luck.

4

0 回答 0