Forum: Ruby RSS Parser 0.1.7

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2007-03-17 12:24
(Received via mailing list)
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,
This topic is locked and can not be replied to.