Forum: Ruby on Rails Test if remote file is actually RSS/XML

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B0ff75d809fdbc09adaba01ffb451c70?d=identicon&s=25 Dave Flynn (analogue40)
on 2006-03-17 12:17
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
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Mikkel Bruun (Guest)
on 2006-03-17 12:31
(Received via mailing list)
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
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails


Mikkel Bruun

www.strongside.dk    - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk      - Buy Old Stuff!(DK)
B0ff75d809fdbc09adaba01ffb451c70?d=identicon&s=25 Dave Flynn (analogue40)
on 2006-03-17 17:48
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 Bruun 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
>>Rails@lists.rubyonrails.org
>>http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
> Mikkel Bruun
>
> www.strongside.dk    - Football Portal(DK)
> nflfeed.helenius.org - Football News(DK)
> ting.minline.dk      - Buy Old Stuff!(DK)
This topic is locked and can not be replied to.