[ANN] RSS Parser 0.1.7

K

Kouhei Sutou

Hi,

I released RSS Parser 0.1.7:
http://raa.ruby-lang.org/project/rss/

Here are new features:

* Atom support
* (official) DublinCore module with RSS 2.0 support
* New convenience methods to convert feed type: to_xml,
to_feed, to_rss, to_atom and to_xml.

Here are changes:

* dc_rightses -> dc_rights_list: Thanks to Mathieu Bouchard!
* Stop ruby 1.6.x support


= Details

== Atom support

Atom support means the followings:

* RSS::parser.parse can parse Atom feed document with
validation.
* RSS::parser.parse can parse Atom entry document with
validation.
* RSS::Maker.make can make Atom feed document.
* RSS::Maker.make can make Atom entry document.

To support Atom, I changed the following reading APIs of RSS
Maker:

* maker.channel.title
* maker.channel.description
* maker.channel.copyright
* item.title
* item.link
* item.description
* item.rights

They return a String or nil since 0.1.6. But They always
return an object.

I think this change doesn't have big impact because most of
users don't use them. They always use only writer APIs.

== DublinCore module with RSS 2.0 support

RSS Parser parses DublinCore module in RSS 2.0 now
officially. We need to require some files. We can just write
the following:

require 'rss'
feed = RSS::parser.parse(...)

== Feed conversion

We can convert RSS 1.0 to RSS 2.0 by the following code:

rss20 = rss10.to_rss("2.0")

We can convert RSS 1.0 to Atom feed document by the
following code:

feed = rss10.to_atom("feed")

But you may need to set some values required by returned
feed type but not required by converted feed. For example,
/rss/item/title isn't required value in RSS 2.0 but
/rdf:RDF/item/title is required value in RSS 1.0. In the
situation, we can set default value like the following:

rss10 = rss20.to_rss("1.0") do |maker|
maker.items.each do |item|
item.title.content ||= "Default Title"
end
end




Thanks,
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top