I am trying to a read a RSS feed and display in my C# application. i have used the code below and it works perfectly for other RSS feeds. I want to read this RSS feed ---> http://ptwc.weather.gov/ptwc/feeds/ptwc_rss_indian.xml and the code below doesn't work for it. I don't get any errors but nothing happens, the text box which i want the RSS feed to be displayed is empty. Please help. What am I doing wrong?
public class RssNews { public string Title; public string PublicationDate; public string Description; } public class RssReader { public static List<RssNews> Read(string url) { var webResponse = WebRequest.Create(url).GetResponse(); if (webResponse == null) return null; var ds = new DataSet(); ds.ReadXml(webResponse.GetResponseStream()); var news = (from row in ds.Tables["item"].AsEnumerable() select new RssNews { Title = row.Field<string>("title"), PublicationDate = row.Field<string>("pubDate"), Description = row.Field<string>("description") }).ToList(); return news; } } private string covertRss(string url) { var s = RssReader.Read(url); StringBuilder sb = new StringBuilder(); foreach (RssNews rs in s) { sb.AppendLine(rs.Title); sb.AppendLine(rs.PublicationDate); sb.AppendLine(rs.Description); } return sb.ToString(); } //Form Load code///
string readableRss; readableRss = covertRss("http://ptwc.weather.gov/ptwc/feeds/ptwc_rss_indian.xml"); textBox5.Text = readableRss;