Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.20
Fixed in: (no value)

Attachments


Subject: XML-Feed vs XML-RSS messup
Download (untitled) / with headers
text/plain 286b
As reported in http://rt.cpan.org/Ticket/Display.html?id=23588 (and I thought it went CC to you but maybe not, so I'm reporting again here) Version 1.20 broke XML::Feed and 1.21 did not improve upon. I don't know if it is a bug in XML-Feed or XML-RSS. But I hope you can judge quicker.
Subject: Re: [rt.cpan.org #23822] XML-Feed vs XML-RSS messup
Date: Tue, 5 Dec 2006 20:07:13 -0800
To: bug-XML-RSS [...] rt.cpan.org
From: Ask Bjørn Hansen <ask [...] perl.org>
Download (untitled) / with headers
text/plain 449b
On Dec 5, 2006, at 19:55, Andreas Koenig via RT wrote: Show quoted text
> As reported in http://rt.cpan.org/Ticket/Display.html?id=23588 (and I > thought it went CC to you but maybe not, so I'm reporting again here)
Ah, I saw the CC but missed that it wasn't going into the XML-RSS queue so I promptly forgot, sorry! I will look into it. Any chance you can show a test case? - ask -- http://log.perl.org/ - http://askask.com/ - http://develooper.com/
Subject: Re: [rt.cpan.org #23822] XML-Feed vs XML-RSS messup
Date: Tue, 5 Dec 2006 23:11:37 -0800
To: bug-XML-RSS [...] rt.cpan.org
From: Ask Bjørn Hansen <ask [...] perl.org>
Download (untitled) / with headers
text/plain 255b
On Dec 5, 2006, at 8:08 PM, ask@perl.org via RT wrote: Show quoted text
> Ah, I saw the CC but missed that it wasn't going into the XML-RSS > [...]
eh, that it went into the XML-Feed queue. -- http://log.perl.org/ - http://askask.com/ - http://develooper.com/
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #23822] XML-Feed vs XML-RSS messup
Date: Wed, 06 Dec 2006 08:12:59 +0100
To: bug-XML-RSS [...] rt.cpan.org
From: andreas.koenig.gmwojprw [...] franz.ak.mind.de (Andreas J. Koenig)
Download (untitled) / with headers
text/plain 1.9k
Show quoted text
>>>>> On Tue, 05 Dec 2006 23:08:00 -0500, "ask@perl.org via RT" <bug-XML-RSS@rt.cpan.org> said:
Show quoted text
Show quoted text
> On Dec 5, 2006, at 19:55, Andreas Koenig via RT wrote:
Show quoted text
>> As reported in http://rt.cpan.org/Ticket/Display.html?id=23588 (and I >> thought it went CC to you but maybe not, so I'm reporting again here)
Show quoted text
> Ah, I saw the CC but missed that it wasn't going into the XML-RSS > queue so I promptly forgot, sorry!
Show quoted text
> I will look into it. Any chance you can show a test case?
XML::Feed comes with the test case. Something to do with text/plain and RSS 1.0. You can outcomment in the testscript RSS 2.0 and Atom as I do like so: my %Feeds = ( # 't/samples/atom.xml' => 'Atom', 't/samples/rss10.xml' => 'RSS 1.0', # 't/samples/rss20.xml' => 'RSS 2.0', ); and you still see the test failure. Here the full test: Show quoted text
>08:04:11 k@k75:~/.cpan/build/XML-Feed-0.12-n7peSR% /home/src/perl/repoperls/installed-perls/*/*/perl-*@29472/bin/prove t/01-parse.t
t/01-parse....NOK 44/72 # Failed test at t/01-parse.t line 59. # 'Hello!...' # doesn't match '(?-xism:<p>Hello!</p>)' t/01-parse....NOK 45/72 # Failed test at t/01-parse.t line 60. # got: undef # expected: 'Hello!...' t/01-parse....ok 56/72# Looks like you failed 2 tests of 72. t/01-parse....dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 44-45 Failed 2/72 tests, 97.22% okay Failed Test Stat Wstat Total Fail List of Failed ------------------------------------------------------------------------------- t/01-parse.t 2 512 72 2 44-45 Failed 1/1 test scripts. 2/72 subtests failed. Files=1, Tests=72, 4 wallclock secs ( 1.45 cusr + 0.05 csys = 1.50 CPU) Failed 1/1 test programs. 2/72 subtests failed. -- andreas
From: Shlomi Fish <shlomif [...] iglu.org.il>
Download (untitled) / with headers
text/plain 2.2k
Hi ANDK and ABH! Attached is a patch for XML::RSS to fix this problem, along with an XML::RSS test suite. The problem was that the "content" module was not defined by default, which caused $item->{content}->{encoded} to fail. Ask, please apply it. Regards, Shlomi Fish On Wed Dec 06 02:13:38 2006, andreas.koenig.gmwojprw@franz.ak.mind.de wrote: Show quoted text
> >>>>> On Tue, 05 Dec 2006 23:08:00 -0500, "ask@perl.org via RT"
<bug- Show quoted text
> XML-RSS@rt.cpan.org> said: > > >
> > On Dec 5, 2006, at 19:55, Andreas Koenig via RT wrote:
> > (and I
> >> thought it went CC to you but maybe not, so I'm reporting again
> here) >
> > Ah, I saw the CC but missed that it wasn't going into the
XML-RSS Show quoted text
> > queue so I promptly forgot, sorry!
>
> > I will look into it. Any chance you can show a test case?
> > XML::Feed comes with the test case. Something to do with text/plain > and RSS 1.0. You can outcomment in the testscript RSS 2.0 and Atom
as Show quoted text
> I do like so: > > my %Feeds = ( > # 't/samples/atom.xml' => 'Atom', > 't/samples/rss10.xml' => 'RSS 1.0', > # 't/samples/rss20.xml' => 'RSS 2.0', > ); > > and you still see the test failure. Here the full test: >
> >08:04:11 k@k75:~/.cpan/build/XML-Feed-0.12-n7peSR%
> /home/src/perl/repoperls/installed-perls/*/*/perl-*@29472/bin/prove > t/01-parse.t > t/01-parse....NOK 44/72 > # Failed test at t/01-parse.t line 59. > # 'Hello!...' > # doesn't match '(?-xism:<p>Hello!</p>)' > t/01-parse....NOK 45/72 > # Failed test at t/01-parse.t line 60. > # got: undef > # expected: 'Hello!...' > t/01-parse....ok 56/72# Looks like you failed 2 tests of 72. > t/01-parse....dubious > Test returned status 2 (wstat 512, 0x200) > DIED. FAILED tests 44-45 > Failed 2/72 tests, 97.22% okay > Failed Test Stat Wstat Total Fail List of Failed > ------------------------------------------------------------------------------- > t/01-parse.t 2 512 72 2 44-45 > Failed 1/1 test scripts. 2/72 subtests failed. > Files=1, Tests=72, 4 wallclock secs ( 1.45 cusr + 0.05 csys =
1.50 Show quoted text
> CPU) > Failed 1/1 test programs. 2/72 subtests failed. > > > > >
=== t/1.0-parse-2.t ================================================================== --- t/1.0-parse-2.t (revision 484) +++ t/1.0-parse-2.t (revision 485) @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 6; +use Test::More tests => 7; use XML::RSS; @@ -56,3 +56,18 @@ ); } } + + +{ + my $rss = XML::RSS->new(); + + $rss->parsefile(File::Spec->catfile("examples","1.0","with_content.rdf")); + + { + my $item = $rss->{items}->[0]; + + # TEST + is ($item->{content}->{encoded}, "<p>Hello!</p>", + "Testing the \"content\" namespace"); + } +} === MANIFEST ================================================================== --- MANIFEST (revision 484) +++ MANIFEST (revision 485) @@ -15,6 +15,7 @@ examples/1.0/rss1.0.rdf examples/1.0/slash.rdf examples/1.0/update_rss_1.0.pl +examples/1.0/with_content.rdf examples/2.0/sf-hs-with-lastBuildDate.rss examples/2.0/sf-hs-with-pubDate.rss examples/convert.pl === lib/XML/RSS.pm ================================================================== --- lib/XML/RSS.pm (revision 484) +++ lib/XML/RSS.pm (revision 485) @@ -416,7 +416,8 @@ 'http://purl.org/rss/1.0/modules/syndication/' => 'syn', 'http://purl.org/dc/elements/1.1/' => 'dc', 'http://purl.org/rss/1.0/modules/taxonomy/' => 'taxo', - 'http://webns.net/mvcb/' => 'admin' + 'http://webns.net/mvcb/' => 'admin', + 'http://purl.org/rss/1.0/modules/content/' => 'content', }; } === examples/1.0/with_content.rdf ================================================================== --- examples/1.0/with_content.rdf (revision 484) +++ examples/1.0/with_content.rdf (revision 485) @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> + +<rdf:RDF +xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" +xmlns:dc="http://purl.org/dc/elements/1.1/" +xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" +xmlns:admin="http://webns.net/mvcb/" +xmlns:cc="http://web.resource.org/cc/" +xmlns:content="http://purl.org/rss/1.0/modules/content/" +xmlns="http://purl.org/rss/1.0/"> + +<channel rdf:about="http://localhost/weblog/"> +<title>First Weblog</title> +<link>http://localhost/weblog/</link> +<description>This is a test weblog.</description> +<dc:language>en-us</dc:language> +<dc:creator>Melody</dc:creator> +<dc:date>2004-05-29T23:39:57-08:00</dc:date> +<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=3.0D" /> + + +<items> +<rdf:Seq><rdf:li rdf:resource="http://localhost/weblog/2004/05/entry_two.html" /> +<rdf:li rdf:resource="http://localhost/weblog/2004/05/test.html" /> +</rdf:Seq> +</items> + +</channel> + +<item rdf:about="http://localhost/weblog/2004/05/entry_two.html"> +<title>Entry Two</title> +<link>http://localhost/weblog/2004/05/entry_two.html</link> +<description>Hello!...</description> +<content:encoded><![CDATA[<p>Hello!</p>]]></content:encoded> +<dc:subject>Travel</dc:subject> +<dc:creator>Melody</dc:creator> +<dc:date>2004-05-29T23:39:25-08:00</dc:date> +</item> +<item rdf:about="http://localhost/weblog/2004/05/test.html"> +<title>Test</title> +<link>http://localhost/weblog/2004/05/test.html</link> +<description>This is a test. Why don&apos;t you come down to our place for a coffee and a chat?...</description> +<content:encoded><![CDATA[<p>This is a test.</p> + +<p>Why don't you come down to our place for a coffee and a <strong>chat</strong>?</p>]]></content:encoded> +<dc:subject>Sports</dc:subject> +<dc:creator>Melody</dc:creator> +<dc:date>2004-05-08T23:03:28-08:00</dc:date> +</item> + + +</rdf:RDF>
From: SHLOMIF [...] cpan.org
Download (untitled) / with headers
text/plain 2.7k
On Tue Dec 12 13:44:12 2006, SHLOMIF wrote: Show quoted text
> Hi ANDK and ABH! > > Attached is a patch for XML::RSS to fix this problem, along with an > XML::RSS test suite. The problem was that the "content" module was
not Show quoted text
> defined by default, which caused $item->{content}->{encoded} to
fail. Show quoted text
> > Ask, please apply it. >
Hi! Here is another patch to fix a related problem that this patch needs to be applied against. My log for it reads: <<<<<<<<<<<< Fixed the problem with a version => "2.0" RSS not parsing correctly the namespaced elements in a RSS 1.0 feed. Show quoted text
>>>>>>>>>>>>
Regards, Shlomi Fish Show quoted text
> Regards, > > Shlomi Fish > > On Wed Dec 06 02:13:38 2006,
andreas.koenig.gmwojprw@franz.ak.mind.de Show quoted text
> wrote:
> > >>>>> On Tue, 05 Dec 2006 23:08:00 -0500, "ask@perl.org via RT"
> <bug-
> > XML-RSS@rt.cpan.org> said: > > > > > >
> > > On Dec 5, 2006, at 19:55, Andreas Koenig via RT wrote:
> > > > (and I
> > >> thought it went CC to you but maybe not, so I'm reporting
again Show quoted text
> > here) > >
> > > Ah, I saw the CC but missed that it wasn't going into the
> XML-RSS
> > > queue so I promptly forgot, sorry!
> >
> > > I will look into it. Any chance you can show a test case?
> > > > XML::Feed comes with the test case. Something to do with
text/plain Show quoted text
> > and RSS 1.0. You can outcomment in the testscript RSS 2.0 and Atom
> as
> > I do like so: > > > > my %Feeds = ( > > # 't/samples/atom.xml' => 'Atom', > > 't/samples/rss10.xml' => 'RSS 1.0', > > # 't/samples/rss20.xml' => 'RSS 2.0', > > ); > > > > and you still see the test failure. Here the full test: > >
> > >08:04:11 k@k75:~/.cpan/build/XML-Feed-0.12-n7peSR%
> > /home/src/perl/repoperls/installed-perls/*/*/perl-*@29472/bin/prove
> > t/01-parse.t > > t/01-parse....NOK 44/72 > > # Failed test at t/01-parse.t line 59. > > # 'Hello!...' > > # doesn't match '(?-xism:<p>Hello!</p>)' > > t/01-parse....NOK 45/72 > > # Failed test at t/01-parse.t line 60. > > # got: undef > > # expected: 'Hello!...' > > t/01-parse....ok 56/72# Looks like you failed 2 tests of 72. > > t/01-parse....dubious > > Test returned status 2 (wstat 512, 0x200) > > DIED. FAILED tests 44-45 > > Failed 2/72 tests, 97.22% okay > > Failed Test Stat Wstat Total Fail List of Failed > >
> -------------------------------------------------------------------------------
> > t/01-parse.t 2 512 72 2 44-45 > > Failed 1/1 test scripts. 2/72 subtests failed. > > Files=1, Tests=72, 4 wallclock secs ( 1.45 cusr + 0.05 csys =
> 1.50
> > CPU) > > Failed 1/1 test programs. 2/72 subtests failed. > > > > > > > > > >
> >
=== t/test_manifest ================================================================== --- t/test_manifest (revision 469) +++ t/test_manifest (revision 471) @@ -9,6 +9,7 @@ 0.91-parse.t 1.0-generate.t 1.0-parse.t +1.0-parse-2.t 1.0-parse-exotic.t 2.0-generate.t 2.0-modules.t === t/1.0-parse-2.t ================================================================== --- t/1.0-parse-2.t (revision 469) +++ t/1.0-parse-2.t (revision 471) @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 6; + +use XML::RSS; + +{ + my $rss = XML::RSS->new(); + + $rss->parsefile(File::Spec->catfile("examples","merlyn1.rss")); + + { + my $item = $rss->{items}->[0]; + + # TEST + is ($item->{dc}->{creator}, "merlyn", + "item[0]/dc/creator in RSS 1.0" + ); + + # TEST + is ($item->{dc}->{date}, "2006-10-05T14:56:02+00:00", + "item[0]/dc/date in RSS 1.0" + ); + + # TEST + is ($item->{dc}->{subject}, "journal", + "item[0]/dc/subject in RSS 1.0" + ); + } +} + +{ + my $rss = XML::RSS->new(version => "2.0"); + + $rss->parsefile(File::Spec->catfile("examples","merlyn1.rss")); + + { + my $item = $rss->{items}->[0]; + + # TEST + is ($item->{dc}->{creator}, "merlyn", + "item[0]/dc/creator in RSS 1.0" + ); + + # TEST + is ($item->{dc}->{date}, "2006-10-05T14:56:02+00:00", + "item[0]/dc/date in RSS 1.0" + ); + + # TEST + is ($item->{dc}->{subject}, "journal", + "item[0]/dc/subject in RSS 1.0" + ); + } +} === MANIFEST ================================================================== --- MANIFEST (revision 469) +++ MANIFEST (revision 471) @@ -36,6 +36,7 @@ t/1.0-generate.t t/1.0-parse-exotic.t t/1.0-parse.t +t/1.0-parse-2.t t/1.0-to-2.0.t t/2.0-generate.t t/2.0-modules.t === lib/XML/RSS.pm ================================================================== --- lib/XML/RSS.pm (revision 469) +++ lib/XML/RSS.pm (revision 471) @@ -1954,6 +1954,15 @@ sub parse { my $self = shift; $self->_initialize((%$self)); + + # Workaround to make sure that if we were defined with version => "2.0" + # then we can still parse 1.0 and 0.9.x feeds correctly. + if ($self->{version} eq "2.0") + { + $self->{modules} = + +{%{$self->_get_default_modules()}, %{$self->{modules}}}; + } + $self->SUPER::parse(shift); $self->_auto_add_modules if $AUTO_ADD; $self->{version} = $self->{_internal}->{version}; @@ -1962,6 +1971,15 @@ sub parsefile { my $self = shift; $self->_initialize((%$self)); + + # Workaround to make sure that if we were defined with version => "2.0" + # then we can still parse 1.0 and 0.9.x feeds correctly. + if ($self->{version} eq "2.0") + { + $self->{modules} = + +{%{$self->_get_default_modules()}, %{$self->{modules}}}; + } + $self->SUPER::parsefile(shift); $self->_auto_add_modules if $AUTO_ADD; $self->{version} = $self->{_internal}->{version};
From: ABH [...] cpan.org
Download (untitled) / with headers
text/plain 163b
Thanks Andreas & Shlomi, Applied in r8406. I'll upload it to CPAN now. Get it from there or from http://tmp.askask.com/2006/12/XML-RSS-1.22.tar.gz - ask


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.