I have tried used this code for insert feeds in listbox but with youtube feeds it not work. Sorry but I do not know much about xml
XmlDocument RSSXml = new XmlDocument();
RSSXml.Load("http://gdata.youtube.com/feeds/api/users/google/uploads");
XmlNodeList RSSNodeList = RSSXml.SelectNodes("feed");
XmlNode RSSDesc = RSSXml.SelectSingleNode("feed");
foreach (XmlNode RSSNode in RSSNodeList)
{
XmlNode RSSSubNode;
RSSSubNode = RSSNode.SelectSingleNode("title");
string title = RSSSubNode != null ? RSSSubNode.InnerText : "";
RSSSubNode = RSSNode.SelectSingleNode("link");
string link = RSSSubNode != null ? RSSSubNode.InnerText : "";
listBox1.Items.Add(title);
}
instead, this works
//Fetch the subscribed RSS Feed
XmlDocument RSSXml = new XmlDocument();
RSSXml.Load("mywebsite/feed/");
XmlNodeList RSSNodeList = RSSXml.SelectNodes("rss/channel/item");
XmlNode RSSDesc = RSSXml.SelectSingleNode("rss/channel/title");
foreach (XmlNode RSSNode in RSSNodeList)
{
XmlNode RSSSubNode;
RSSSubNode = RSSNode.SelectSingleNode("title");
string title = RSSSubNode != null ? RSSSubNode.InnerText : "";
RSSSubNode = RSSNode.SelectSingleNode("link");
string link = RSSSubNode != null ? RSSSubNode.InnerText : "";
listBox1.Items.Add(title);
listBox2.Items.Add(link);
}
Thanks for your answers
Namespaces do mather in selecting nodes in an xml document. You have to add a namespacemanger and explicitly indicate which element you want. Also selecting attributes (for the link) is different than just innertext of an element.
See SelectNodes with a namespacemanager