I'm trying to parse a iTunes podcast XML feed in C# and am having trouble. It successfully downloads the feed and puts it into the XmlDocument object (tested). After that, it goes to the for-each line, but never enters the loop. I have no idea why it's saying that there aren't any elements in channel/item (at least that's what I'm thinking at this time). Heres the code:
string _returnedXMLData;
XmlDocument _podcastXmlData = new XmlDocument();
public List<PodcastItem> PodcastItemsList = new List<PodcastItem> ();
_podcastXmlData.Load(@"http://ift.tt/1tVHTLI");
string title = string.Empty;
string subtitle = string.Empty;
string author = string.Empty;
foreach (XmlNode node in _podcastXmlData.SelectNodes(@"channel/item")) {
title = node.SelectSingleNode (@"title").InnerText;
subtitle = node.SelectSingleNode (@"itunes:subtitle").InnerText;
author = node.SelectSingleNode (@"itunes:author").InnerText;
PodcastItemsList.Add (new PodcastItem(title, subtitle, author));
}
}
Thank you in advance for any assistance! It's much appreciated!
Kirkland
No comments:
Post a Comment