Feed normalizer and Atom

30 views
Skip to first unread message

Bill Kocik

unread,
Sep 23, 2008, 2:01:46 PM9/23/08
to Ruby on Rails: Talk
Hi all -

I can't find any feed normalizer groups, so I'm trying here. In trying
to parse an Atom feed with feed normalizer 1.5.1 and Ruby 1.8.7-p72, I
get this error:

>> feed = FeedNormalizer::FeedNormalizer.parse open('http://www.atomenabled.org/atom.xml')
NoMethodError: undefined method `channel' for #<RSS::Atom::Feed:
0x3a4d460>
from /usr/local/lib/ruby/gems/1.8/gems/feed-normalizer-1.5.1/
lib/parsers/rss.rb:51:in `package'
from /usr/local/lib/ruby/gems/1.8/gems/feed-normalizer-1.5.1/
lib/parsers/rss.rb:23:in `parse'
from /usr/local/lib/ruby/gems/1.8/gems/feed-normalizer-1.5.1/
lib/feed-normalizer.rb:130:in `parse'
from /usr/local/lib/ruby/gems/1.8/gems/feed-normalizer-1.5.1/
lib/feed-normalizer.rb:129:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/feed-normalizer-1.5.1/
lib/feed-normalizer.rb:129:in `parse'
from (irb):2

Anyone have any idea what this is about? It's true that
RSS::Atom::Feed doesn't define a 'channel' method, and the normalizer
is trying to call it, but I'm not sure what the path to resolution is.
Thought maybe someone here might.

Daniel Choi

unread,
Sep 23, 2008, 6:18:05 PM9/23/08
to Ruby on Rails: Talk

Try doing this

FeedNormalizer::FeedNormalizer.parse(xml, :force_parser =>
FeedNormalizer::SimpleRssParser)

This :force_parser setting will try to avoid calling the method that
contains this call to `channel'

Dan

Daniel Choi

unread,
Sep 23, 2008, 6:45:00 PM9/23/08
to Ruby on Rails: Talk

I forgot, you might also want to add the :try_others => true option in
there as well

Bill Kocik

unread,
Sep 23, 2008, 11:47:49 PM9/23/08
to Ruby on Rails: Talk
Thanks so much, Dan. :force_parser did the trick, and I
added :try_others to my parse calls for good measure.

Much appreciated.
Reply all
Reply to author
Forward
0 new messages