Reading non-standard/custom attributes in Atom feeds with standard Ruby RSS Library - How?

Hello,

Using the latest version of the standard web feed library
(RSS::Parser) [1], that is, 0.2.4, I tried to configure or extend it
so I can read/access non-standard (custom) feed attributes such as the
Google Readers’ original-id. Example:

tag:google.com,2005:reader/item/7931b28aaa03e64c

If anyone has tried something similar or has any tips or tricks on
how to go about I greatly appreciate it. Cheers.

[1] http://raa.ruby-lang.org/project/rss

Hello,

Using the latest version of the standard web feed library
(RSS::Parser) [1], that is, 0.2.4, I tried to configure or extend it
so I can read/access non-standard (custom) feed attributes such as the
Google Readers’ original-id. Example:

tag:google.com,2005:reader/item/7931b28aaa03e64c

If anyone has tried something similar or has any tips or tricks on
how to go about I greatly appreciate it.

I’ve got it working. [1] It looks like the standard RSS::Parser
library cannot handle XML attributes with a dash (such as original-id)
because it generates Ruby attributes using the XML attribute’s name,
thus, leading to invalid Ruby identifiers. Using a .gsub(
‘gr:original-id’, ‘gr:original_id’ ) on the feed data works around it
although ideally I rather prefer not to.

Any comments, fixes or alternative workarounds welcome. Cheers.

[1]:
module RSS
module Atom

class Feed
  class Entry

   class Id < RSS::Element

     install_get_attribute( 'original_id', "", false )

   end

  end
end

end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs