I am trying to use XPath in C# to fetch the href value of the <link> nodes at the YouTube most popular Atom feed.
From the documentation I have read online, this process would be relatively simple, something along the lines of:
XmlDocument xml = new XmlDocument();
xml.Load("http://gdata.youtube.com/feeds/api/standardfeeds/most_popular");
XmlNodeList linkNodes;
linkNodes = xml.SelectNodes("/feed/entry/link[@rel='alternate']");
But this doesn’t work, I get no results. I’ve tried adding namespaces with an XmlNamespaceManager but that doesn’t help, either.
Hasty reply would be appreciated! Thank you!
I’m sure adding namespaces properly would help, as I’m sure that’s the problem. Personally I’d use LINQ to XML instead though. Sample code: