tags:

views:

137

answers:

2

Hi

I'm currently using the RSS.MET class library to open and read feeds, but I need to be able to find out if a supplied feed is actually valid. For example, if I pass it "http://www.google.com", I want it to tell me that it isn't a valid RSS feed. How would I go about doing this?

I've already tried passing it through a try .. catch block.

try
{
    Rss.RssReader reader = new Rss.RssReader(cast.PodcastURL);    
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}

But that hasn't returned the desired effect.

A: 

According to the documentation, RssReader.Read will throw an exception if it can't read the rss file. (I guess it will be an XmlException).

Tamás Szelei
In the case, it's recognising the URLs I pass it as valid RSS feeds
A: 

Well if for some reason you don't want to work with the exception method, you could load the data in a xml file and check whether it has a top node rss...

I have worked extensively with RSS and Atom feeds but haven't used any special class to handle... Linq to XML makes handling raw XML pretty easy... :)

Cyril Gupta
That sounds like the best bet so far to me
Well, it's tested and certified to work :). Does this library do Atom? If not then you're losing a pretty good chunk. Atom feeds need to be subscribed too.
Cyril Gupta