Jump to content

RSS content validation using Regular Expr.


aniesh82

Recommended Posts

Hi,

 

I have to test whether the returned data is a valid RSS file contents or not. For doing that, I can check the header along with the data. But I wish to check the structure of the RSS and I only needed RSS feed of version 2.0.  Can someone correct this Reg Expr?

 

Example URL: (view page source)

 

http://rss.news.yahoo.com/rss/topstories

 

 

$pattern = '#<\?xml .*(version=\"1.0\").*\?>(\s)*<rss .*(version=\"2.0\").*>(\s)*<channel>(\s)*<title>(.*)</title>(\s)*.*<description>.*</description>.*(<item>.*</item>)*#';

 

 

Upto description it works well. But after that, it doesn't return the expected result.

 

 

Also I have to check the Two Ending tags. "</channel></rss>" ..

 

Thank You,

Joseph.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.