Can't get my rss to validate with feedtools


#1

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 B.”
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 B.</dc:creator>
        ^

Source: http://server:3000/pragmatic/rss

  1. er
  2. http://server:3000/pragmatic/
  3. dc:creatorCharlie B.</dc:creator>
  4. content:encoded
  5. <![CDATA[

    gdf

    ]]>
  6. </content:encoded>
  7. Mon, 20 Mar 2006 18:52:17 -0000
  8. http://server:3000/pragmatic/

Home · About · News · Docs


#2

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" ?> My funky RSS feed If it's happening, you'll find it here! http://www.mysite.com  er  http://server:3000/pragmatic/  Charlie B.    <![CDATA[

gdf

]]> Â Â Mon, 20 Mar 2006 18:52:17 -0000 Â http://server:3000/pragmatic/

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 S.
Rent-A-Monkey Website Development
http://www.rentamonkey.com/

PGP Key: http://www.rentamonkey.com/pgpkey.asc


#3

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 S. wrote:

<?xml version="1.0" ?>
    <![CDATA[<p>gdf</p>]]>

Any help?

~Dave

Charlie B.
Programmer
Castle Branch Inc.


#4

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 A.

AIM: sporkmonger
Jabber: removed_email_address@domain.invalid