tags:

views:

28

answers:

3

Hi There,

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 succeeds and some times it fails .

the url i am using is

http://rss.nzherald.co.nz/rss/xml/nzhrsscid%5F000000004.xml

what could be the probelm, is it like the RSS is not updated properly..?

any suggestions/comments

Regards DEE

A: 

Hi there.

Can you give some details about the failure? What error do you get when loading the RSS feed into the XmlDocument?

As a stab in the dark, could it be that the RSS XML is invalid when you get a failure?

Cheers. Jas.

Jason Evans
extactly the xml is invalid , so the question is why? and how to handle it
DEE
A: 

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.

jrista
thanks for the response,i am on 2.0 . the question is why RSS xml is not proper all the time ,and how to deal with it. does anyone have this problem or is it only me.
DEE
A: 

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

DaTribe