Subject: | XML::RSSLite handling of RDF 0.9/1.0/2.0 vs. 0.91/0.92 |
We are attempting to get XML::RSSLite 0.11 working correctly in WebGUI
and
have run into a parsing issue with the two different RDF formats.
1.0 file: http://www.kuro5hin.org/backend.rdf
0.91 file: http://www.newsisfree.com/HPE/xml/feeds/55/3355.xml
As I'm sure you know, one of the main differences is the way the channel
element works. After parsing, these files result in differing data
structures in RSSLite. The 1.0 file stores the channel data in a nested
hash:
'channel' => {
'description' => 'technology and culture, from
the
trenches',
'title' => 'kuro5hin.org',
'link' => 'http://www.kuro5hin.org/'
},
Therefore to access this you need to use code such as
$rss{channel}{title}.
The 0.91 file is stored without this channel hash key:
$VAR1 = {
'description' => 'Everything Space. For space and astronomy
news,
chat, email, forums, videos, and more. (By
http://www.newsisfree.com/syndicate.php - FOR PERSONAL AND NON
COMMERCIAL
USE ONLY!)',
'title' => 'Everything Space',
'link' => 'http://www.everything-space.com/'
}
So, these are accessed using simply $rss{title}.
My question is if there is a way for you to create a compatible data
structure for both formats? Or should we try to check which data format
is
currently being used ( $title = $rss{title} || $rss{channel}{title} )?
I have no idea how this would affect the other 2 supported formats in
RSSLite (ScriptingNews, Weblog) since I haven't run across any newsfeeds
in
those formats yet.