RSS Maker : LastBuildDate / TTL / Copyright

M

Mike Flint

Hi,

Does anyone know how to code an RSS maker to generate additional tags
for the header of the feed? The gem has a method for 'lastBuildDate='
but I cannot get it to work ...

************************************************
content = RSS::Maker.make(Version) do |m|
m.channel.title = "xxxx"
m.channel.link = "http://yyyyyyyy"
m.channel.description = "zzzzz"
m.channel.lastBuildDate= Time.now
************************************************

- produces:

/usr/lib/ruby/1.8/rss/0.9.rb:107:in `lastBuildDate=': value <Tue Jan 18
14:22:44 +0000 2011> of tag <lastBuildDate> is not available.
(RSS::NotAvailableValueError)

I have tried several variations with no joy, and the documentation is
not helpful.

I can't find anything that might set the ttl or copyright values.

Anyone managed to generate a full-feature RSS xml file using this?

Thanks.
Mike.
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"RSS Maker : LastBuildDate / TTL / Copyright" on Tue, 18 Jan 2011 23:43:37 +0900,
Mike Flint said:
Does anyone know how to code an RSS maker to generate additional tags
for the header of the feed? The gem has a method for 'lastBuildDate='
but I cannot get it to work ...

************************************************
content = RSS::Maker.make(Version) do |m|
m.channel.title = "xxxx"
m.channel.link = "http://yyyyyyyy"
m.channel.description = "zzzzz"
m.channel.lastBuildDate= Time.now
************************************************

- produces:

/usr/lib/ruby/1.8/rss/0.9.rb:107:in `lastBuildDate=': value <Tue Jan 18
14:22:44 +0000 2011> of tag <lastBuildDate> is not available.
(RSS::NotAvailableValueError)

What Ruby version are you using?
I tried it in Ruby 1.8.7 and worked well.
I can't find anything that might set the ttl or copyright values.

m.channel.ttl = 29
m.channel.copyright = "XXX"

You need to specify "2.0" as "version" of
RSS::Maker.make(version).


Thanks,
 
M

Mike Flint

Hi,

Thanks for the reply.

I'm using Ruby 1.8.7, specifying rss version "2.0".

I have it working now ... well, the copyright is working, and my problem
with lastBuildDate was because I was passing the String representation
of the time, not a Time object - the error message was not obvious.
Passing Time.now and it works.

My final issue (I hope) is that even though I have:

m.channel.ttl = 10

and get no error message, there is no <ttl> tag in the xml. Think I
might need to use some of the Maker class to add it(?)

Thanks again.
 
M

Mike Flint

Ooops!

Scrap that last response. The <ttl> tag is there, it's just at the end
of the XML past the item definitions, but still within the channel.

(grep found what my eyes failed to!)

Sorry for the last post!

Mike.
 

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

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top