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.
Dave F. (Guest)
on 2006-03-17 13: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
Mikkel B. (Guest)
on 2006-03-17 13: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
>removed_email_address@domain.invalid
>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)
Dave F. (Guest)
on 2006-03-17 18: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 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
>>removed_email_address@domain.invalid
>>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)
This topic is locked and can not be replied to.