Skip Menu |

This queue is for tickets about the XML-RSS CPAN distribution.

Report information
The Basics
Id: 9862
Status: resolved
Priority: 0/
Queue: XML-RSS

People
Owner: Nobody in particular
Requestors: chatiman [...] free.fr
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.97
Fixed in: 0.10



Subject: wrong property mapping
$rss->{channel}->{link} is sometimes a concatenation of the : <channel><link> and <channel><textInput> : e.g.: for rss source = http://rss.topix.net/rss/news/journalism.xml $rss->{channel}->{link} == http://www.topix.net/news/journalismhttp://www.topix.net/search/ infos: perl v5.8.4 xml::rss v0.97-4 (debian package)
The problem is that the <textInput> tag of RSS 2.0 (with an uppercase "I") is not recognised by the parser. The attached patch fixes that and adds a testcase. ABH, I suggest you apply the patch.
=== t/test_manifest ================================================================== --- t/test_manifest (revision 448) +++ t/test_manifest (revision 450) @@ -14,6 +14,7 @@ 2.0-modules.t 2.0-permalink.t 2.0-parse.t +2.0-parse-2.t 2.0-wo-title.t 1.0-to-2.0.t auto_add_modules.t === t/2.0-parse-2.t ================================================================== --- t/2.0-parse-2.t (revision 448) +++ t/2.0-parse-2.t (revision 450) @@ -0,0 +1,51 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 2; + +use XML::RSS; + +my $rss = XML::RSS->new(); + +$rss->parse(<<"EOF"); +<?xml version="1.0" encoding="UTF-8" ?> +<?xml-stylesheet href="/rss/news/journalism.xsl" type="text/xsl"?> +<rss version="2.0"> +<channel><title>Journalism - Topix.net</title> +<link>http://www.topix.net/news/journalism</link> +<description>News on Journalism from Topix.net</description> +<language>en-us</language> +<copyright>Copyright 2006, Topix.net</copyright> +<image><title>Topix.net</title> +<link>http://www.topix.net/</link> +<url>http://www.topix.net/pics/logo4.gif</url> +</image> +<item> +<title>Gannett Reportedly Mulling Tribune Bid </title> +<link>http://topix.net/r/0l1Qq8DEtErajq5wDAIHZ0RavmEQ=2BIyZGBfGjcVwyQpW0DFdgUcy=2FtbxGNgMtYEdbU7ucVOR=2Bw2Bu6K4EDvt9=2B7ILEWB6Q5Zxy64f9JxkGU92am=2FLdMjb=2FCxbmfNuBQX6</link> +<description><![CDATA[Gannett Co., the largest newspaper publisher in the nation, has surfaced as a potential buyer of the Chicago Tribune and other newspapers owned by Tribune Co., according to published reports.<br/><a href="http://www.topix.net/forum/link/thread?forum=news/journalism&artsig=435ed4cd01">Comment</a>]]></description> +<source url="http://www.topix.net">The Associated Press on Topix.net</source> +<pubDate>Mon, 13 Nov 2006 15:50:44 GMT</pubDate> +<guid isPermaLink="false">eQE3vmbXGCzvaHn0deSSyA</guid> +<enclosure url="http://64.13.133.31/pics/a49e1416bf69bc4399d74c818517214d-l" length="3597" type="image/jpg" /> +</item> +<textInput> +<title>Journalism - Topix.net</title> +<description>Use the text input below to search Topix.net</description> +<name>q</name> +<link>http://www.topix.net/search/</link> +</textInput></channel> +</rss> +EOF + +# TEST +is ($rss->{textinput}->{link}, "http://www.topix.net/search/", + "Testing for textinput link" +); + +# TEST +is ($rss->{channel}->{link}, "http://www.topix.net/news/journalism", + "Testing for channel link" +); === MANIFEST ================================================================== --- MANIFEST (revision 448) +++ MANIFEST (revision 450) @@ -38,6 +38,7 @@ t/2.0-generate.t t/2.0-modules.t t/2.0-parse.t +t/2.0-parse-2.t t/2.0-permalink.t t/2.0-wo-title.t t/auto_add_modules.t === lib/XML/RSS.pm ================================================================== --- lib/XML/RSS.pm (revision 448) +++ lib/XML/RSS.pm (revision 450) @@ -1617,6 +1617,10 @@ } elsif ( $self->within_element("textinput") || $self->within_element($self->generate_ns_name("textinput",$self->{rss_namespace})) + # textinput is spelled textInput (with a capital "I") in RSS 2.0 + || $self->within_element("textInput") + || $self->within_element($self->generate_ns_name("textInput",$self->{rss_namespace})) + ) { my $ns = $self->namespace($self->current_element);
Applied, thanks. (svn r8401, will be in v1.22) (Man, that's some ugly code - and ugly XML specification...)