Test if remote file is actually RSS/XML

Hi all,
I want my users to be able to view RSS feeds of their choice on my site.
But i’d like to be able to check the files they are submitting as feeds
are actually XML before attempting to parse and display them.
I’ve been using feed tools to display the contents of feeds which works
perfectly, but i’d like some way to check if a file is a feed/xml.

Any pointers in trhe right direction welcome.

(I was thinking about opening the remote file, reading the first x bytes
and testing for the xml declaration)

Thanks

Cant you just chekc if feedtools chokes om them??? in that case its not
a proper feed format…

On Friday, March 17, 2006, at 12:17 PM, dave flynn wrote:

and testing for the xml declaration)

Thanks


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Mikkel B.

www.strongside.dk - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk - Buy Old Stuff!(DK)

Thanks for the reply made me go and have a proper look at the feedtools
API, feedtools doesn’t seem to choke, it just doesn’t display anything
if it’s not a feed.

I went with loading the feed then testing if

@feed.feed_type == nil

Cheers

Mikkel B. wrote:

Cant you just chekc if feedtools chokes om them??? in that case its not
a proper feed format…

On Friday, March 17, 2006, at 12:17 PM, dave flynn wrote:

and testing for the xml declaration)

Thanks


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Mikkel B.

www.strongside.dk - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk - Buy Old Stuff!(DK)