An open question about the RSS stdlib

F

Francis Hwang

Back in November, I built my RSS utility FeedBlender on the RSS
standard library as it stood in (I believe) 1.8.2 preview 3, and it
worked fine. Now as I've come back to take a look at it, I suspect that
a change since then has made FeedBlender break. (I can't verify this
without getting my hands on Ruby 1.8.2 preview 3; if anybody can tell
me where to get this I'd be much obliged.)

Anyway, this is sort of my fault since I'm using the RSS library to
write RSS in a way that Kou had told me isn't supported: You're
supposed to delegate to RSS objects, not inherit from them. Me, I like
inheriting, so that's what I did, and I got bit ... there are some
changes that somewhat mystify me, particularly the fact that it appears
that RSS 2.0 objects now contain RSS::RDF::Item objects, instread of
RSS::Rss::Channel::Item objects ...

I want to fix it, but I could use some counsel regarding the long-term
plans of this library. Seems to me that the parsing is relatively
stable, but the RSS generation is subject to change, right? The
old-fashioned, REXML-style generation is obviously changing. The
tutorial at
http://www.cozmixng.org/~rwiki/?cmd=view;
name=RSS+Parser%3A%3ATutorial.en mentions the RSS::Maker, which seems
like a more Builder-style generation. But that tutorial also
specifically says Maker's API isn't fixed either.

So if I want FeedBlender to use the standard RSS library, and I don't
want to have to adapt to a new API every six months, what's my best
bet?

Thanks,
Francis Hwang
http://fhwang.net/
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"An open question about the RSS stdlib" on Wed, 12 Jan 2005 13:42:03 +0900,
Francis Hwang said:
Back in November, I built my RSS utility FeedBlender on the RSS
standard library as it stood in (I believe) 1.8.2 preview 3, and it
worked fine. Now as I've come back to take a look at it, I suspect that
a change since then has made FeedBlender break.

Sorry, I'll fix.
The
tutorial at
http://www.cozmixng.org/~rwiki/?cmd=view;
name=RSS+Parser%3A%3ATutorial.en mentions the RSS::Maker, which seems
like a more Builder-style generation. But that tutorial also
specifically says Maker's API isn't fixed either.

Sorry, I didn't update the tutorial.
RSS::Maker's API is fixed.
 
F

Francis Hwang

Sorry, I didn't update the tutorial.
RSS::Maker's API is fixed.

Okay then. Now I've got a question about RSS::Maker. I'd like to be
able to get the number of items in an RSS while making it. I tried
this:

rss = RSS::Maker.make( '2.0' ) { |maker|
...
while ( maker.items.size < 20 )
...
end
}

but that doesn't work.

Francis Hwang
http://fhwang.net/
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"Re: An open question about the RSS stdlib" on Fri, 14 Jan 2005 12:03:37 +0900,
Francis Hwang said:
I'd like to be
able to get the number of items in an RSS while making it. I tried
this:

rss = RSS::Maker.make( '2.0' ) { |maker|
...
while ( maker.items.size < 20 )
...
end
}

but that doesn't work.

Does it mean that you want maker.items to have size method?
Then I'll add it.


But, I recommend you to use maker.items.max_size=.

rss = RSS::Maker.make( '2.0' ) { |maker|
...
... do
item = maker.items.new_item
item.title = ...
...
end
...
maker.items.max_size = 20
}

If you want to get more example codes, see
test/rss/test_maker*.rb and sample/rss/blend.rb.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top