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:
: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.
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
I forgot, you might also want to add the :try_others => true option in
there as well
Thanks so much, Dan. :force_parser did the trick, and I
added :try_others to my parse calls for good measure.
Much appreciated.
Hi Dan…
Currently working on FeedNormalizer, feed parsing,
Have tried all the things… this code is woking fine to fetch .rss/rss
feed/other feed types but when I try to fetch atom.xml file…
Like say for eg. fetch any URL like
“http://www.atomenabled.org/atom.xml” with this simple code,
rss =“http://www.atomenabled.org/atom.xml”
rss = FeedNormalizer::FeedNormalizer.parse (rss, :force_parser =>
FeedNormalizer::SimpleRssParser, :try_others => true)
its giving me this error,
NoMethodError in FeedController#create
undefined method `channel’ for #RSS::Atom::Feed:0xb6fd9a88
As u have said, this :force_parser setting try to avoid calling the
method that
contains this call to `channel’, I have included in my code but its not
working at all…
Awaiting for reply,
Thanks in Advance
Naresh Rana wrote:
Hi Dan…
Currently working on FeedNormalizer, feed parsing,
Have tried all the things… this code is woking fine to fetch .rss/rss
feed/other feed types but when I try to fetch atom.xml file…
Like say for eg. fetch any URL like
“http://www.atomenabled.org/atom.xml” with this simple code,
rss =“http://www.atomenabled.org/atom.xml”
rss = FeedNormalizer::FeedNormalizer.parse (rss, :force_parser =>
FeedNormalizer::SimpleRssParser, :try_others => true)
its giving me this error,
NoMethodError in FeedController#create
undefined method `channel’ for #RSS::Atom::Feed:0xb6fd9a88
As u have said, this :force_parser setting try to avoid calling the
method that
contains this call to `channel’, I have included in my code but its not
working at all…
Awaiting for reply,
Thanks in Advance
======
Done… just have written code something like this,
feed_url = “http://www.atomenabled.org/atom.xml”
rss = FeedNormalizer::FeedNormalizer.parse(open(feed_url), :force_parser
=> FeedNormalizer::SimpleRssParser)
Its working now…