I know that I''m doing something wrong, but I can''t figure out what. I''ve looked at every wiki and tutorial I can find on feedtools but I still can''t get my rss feed working. Here''s my code. feed = FeedTools::Feed.new feed.entries << FeedTools::FeedItem.new feed.entries[0].author.name = "Charlie Bowman" feed.entries[0].title = @post.title feed.entries[0].link = "http://server:3000/pragmatic/" feed.entries[0].content = @post.post # Assumes this is inside a .rxml file feed.entries[0].build_xml("rss", 2.0,xml) Here''s what the validator tells me. Thanks for any input! This feed does not validate. * line 1, column 0: Undefined root element: item [help] <item> * line 4, column 2: XML parsing error: <unknown>:4:2: unbound prefix [help] <dc:creator>Charlie Bowman</dc:creator> ^ Source: http://server:3000/pragmatic/rss 1. <item> 2. <title>er</title> 3. <link>http://server:3000/pragmatic/</link> 4. <dc:creator>Charlie Bowman</dc:creator> 5. <content:encoded> 6. <![CDATA[<p>gdf</p>]]> 7. </content:encoded> 8. <pubDate>Mon, 20 Mar 2006 18:52:17 -0000</pubDate> 9. <guid isPermaLink="true">http://server:3000/pragmatic/</guid> 10. </item> 11. Home ? About ? News ? Docs -- Posted via http://www.ruby-forum.com/.
On Monday 20 Mar 2006 18:31, charlie bowman wrote:> I know that I''m doing something wrong, but I can''t figure out what. > I''ve looked at every wiki and tutorial I can find on feedtools but I > still can''t get my rss feed working. Here''s my code.Surely you need to add the XML prolog and say what RSS version you''re using and so on? See: http://searchenginewatch.com/sereport/article.php/2175271 For example, your output code needs to be something more like: <?xml version="1.0" ?> <rss version="2.0"> <channel> <title>My funky RSS feed</title> <description>If it''s happening, you''ll find it here!</description> <link>http://www.mysite.com</link> <item> ? <title>er</title> ?<link>http://server:3000/pragmatic/</link> ?<dc:creator>Charlie Bowman</dc:creator> ?<content:encoded> ? ?<![CDATA[<p>gdf</p>]]> ?</content:encoded> ? <pubDate>Mon, 20 Mar 2006 18:52:17 -0000</pubDate> ?<guid isPermaLink="true">http://server:3000/pragmatic/</guid> </item> </channel> </rss> Hmm... actually, I hadn''t found FeedTools yet (until right this second). Anyway, from the tutorial at: http://sporkmonger.com/articles/2005/08/11/tutorial/ ... looks like you need to call something in your view like: @feed.build_xml((@feed_type or "atom"), 0.0, xml) Are you doing that? From the source you posted, it basically looks like you aren''t turning it into a proper XML document, which should hopefully explain why it won''t validate, since you''re only generating half of it. Any help? ~Dave -- Dave Silvester Rent-A-Monkey Website Development http://www.rentamonkey.com/ PGP Key: http://www.rentamonkey.com/pgpkey.asc
Actually, I gave up on feedtools and decided just to write some xml. I tried to follow sporkmongers tutorial for creating a feed but couldn''t get it to work. On Tue, 2006-03-21 at 03:37 +0000, Dave Silvester wrote:> On Monday 20 Mar 2006 18:31, charlie bowman wrote: > > I know that I''m doing something wrong, but I can''t figure out what. > > I''ve looked at every wiki and tutorial I can find on feedtools but I > > still can''t get my rss feed working. Here''s my code. > > Surely you need to add the XML prolog and say what RSS version you''re using > and so on? See: http://searchenginewatch.com/sereport/article.php/2175271 > > For example, your output code needs to be something more like: > > <?xml version="1.0" ?> > <rss version="2.0"> > <channel> > <title>My funky RSS feed</title> > <description>If it''s happening, you''ll find it here!</description> > <link>http://www.mysite.com</link> > <item> > <title>er</title> > <link>http://server:3000/pragmatic/</link> > <dc:creator>Charlie Bowman</dc:creator> > <content:encoded> > <![CDATA[<p>gdf</p>]]> > </content:encoded> > <pubDate>Mon, 20 Mar 2006 18:52:17 -0000</pubDate> > <guid isPermaLink="true">http://server:3000/pragmatic/</guid> > </item> > </channel> > </rss> > > > Hmm... actually, I hadn''t found FeedTools yet (until right this second). > Anyway, from the tutorial at: > > http://sporkmonger.com/articles/2005/08/11/tutorial/ > > ... looks like you need to call something in your view like: > > @feed.build_xml((@feed_type or "atom"), 0.0, xml) > > Are you doing that? From the source you posted, it basically looks like you > aren''t turning it into a proper XML document, which should hopefully explain > why it won''t validate, since you''re only generating half of it. > > Any help? > > ~Dave >Charlie Bowman Programmer Castle Branch Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060321/801c0503/attachment-0001.html
> I know that I''m doing something wrong, but I can''t figure out what. > I''ve looked at every wiki and tutorial I can find on feedtools but I > still can''t get my rss feed working. Here''s my code. > > feed = FeedTools::Feed.new > > feed.entries << FeedTools::FeedItem.new > > feed.entries[0].author.name = "Charlie Bowman" > feed.entries[0].title = @post.title > feed.entries[0].link = "http://server:3000/pragmatic/" > feed.entries[0].content = @post.post > > # Assumes this is inside a .rxml file > feed.entries[0].build_xml("rss", 2.0,xml)Sorry for digging up this old post, but I only just saw it. Mea culpa. Simple fix: You''re building the XML for the feed item. You need to build the XML for the feed itself: feed.build_xml("rss", 2.0, xml) Cheers, Bob Aman -- AIM: sporkmonger Jabber: sporkmonger@jabber.org