Reading RSS feeds --> not consistent
i am trying to read the RSS feed by loading it to xmldocument
some thing like
xmlTextReader = new XmlTextReader(url);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlTextReader);
some times the loading to xml document succee开发者_如何学Gods and some times it fails .
the url i am using is
http://rss.nzherald.co.nz/rss/xml/nzhrsscid_000000004.xml
what could be the probelm, is it like the RSS is not updated properly..?
any suggestions/comments
Regards DEE
If you are using .NET 3.5, I would look into the System.ServiceModel.Syndication namespace. It provides a very rich and feed-format agnostic library for handling feeds in .NET. It also provides a lot of extensibility that allows you to plug in additional feed formatters, if needed:
http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.aspx
It should simplify your use of RSS, and help you track down odd problems like this, as it provides a cleaner abstraction.
Try using the SyndicationFeed clas. Here is a simple example which will show you clearly how to get this done. If the feed doesn't load then then feed is not constructed properly.
http://www.avantprime.com/articles/view-article/10/getting-syndication-feeds-(rss-atom)-in-.net
精彩评论