Skip Menu |

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

Report information
The Basics
Id: 48405
Status: open
Priority: 0/
Queue: XML-RSS

People
Owner: Nobody in particular
Requestors: dswhite42 [...] yahoo.com
Cc:
AdminCc:

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



Subject: Namespace checking should allow uppercase letters
I'm running Perl 5.8.8 (Ubuntu 8.04.3 (Hardy) kernel 2.6.24-24). The problem below is Ubuntu's official distribution of XML-RSS (1.31) and also 1.44 which I just downloaded. Using the example that Creative Commons has to demonstrate how to include a license in an RSS file (http://static.userland.com/gems/backend/rssCreativeCommonsExample.xml), I tried this: my $rss = XML::RSS->new( version => '2.0' ); $rss->add_module(prefix=>'creativeCommons', uri=>'http://backend.userland.com/creativeCommonsRssModule'); $rss->channel( title => 'Some title', link => 'http://www.example.com/', ... creativeCommons => {license => 'http://creativecommons.org/licenses/by-nc-nd/3.0/us/'} ); The error generated by XML-RSS is: a namespace prefix should look like [a-z_][a-z0-9.\-_]* at /tmp/rsstest.pl line 14 It doesn't like the capital "C" in the "creativeCommons" namespace prefix, but I can't find anything in the RSS 2.0 spec that requires only lowercase letters in a custom namespace. Is there any reason that something like the patch below can't be done? --- old/lib/XML/RSS.pm 2009-08-03 20:52:49.000000000 -0400 +++ new/lib/XML/RSS.pm 2009-08-03 20:52:49.000000000 -0400 @@ -386,8 +386,8 @@ my $self = shift; my $hash = {@_}; - $hash->{prefix} =~ /^[a-z_][a-z0-9.\-_]*$/ - or croak "a namespace prefix should look like [a-z_][a-z0-9.\\-_]*"; + $hash->{prefix} =~ /^[a-z_][a-z0-9.\-_]*$/i + or croak "a namespace prefix should look like [A-Za-z_][A-Za-z0-9.\\-_]*"; $hash->{uri} or croak "a URI must be provided in a namespace declaration";
On Mon Aug 03 20:56:56 2009, dswhite42 wrote: Show quoted text
> I'm running Perl 5.8.8 (Ubuntu 8.04.3 (Hardy) kernel 2.6.24-24). The > problem below is Ubuntu's official distribution of XML-RSS (1.31) and > also 1.44 which I just downloaded. > > Using the example that Creative Commons has to demonstrate how to > include a license in an RSS file > (http://static.userland.com/gems/backend/rssCreativeCommonsExample.xml), > I tried this: > > my $rss = XML::RSS->new( version => '2.0' ); > $rss->add_module(prefix=>'creativeCommons', > uri=>'http://backend.userland.com/creativeCommonsRssModule'); > $rss->channel( > title => 'Some title', > link => 'http://www.example.com/', > ... > creativeCommons => {license => > 'http://creativecommons.org/licenses/by-nc-nd/3.0/us/'} > ); > > The error generated by XML-RSS is: > > a namespace prefix should look like [a-z_][a-z0-9.\-_]* at > /tmp/rsstest.pl line 14 > > It doesn't like the capital "C" in the "creativeCommons" namespace > prefix, but I can't find anything in the RSS 2.0 spec that requires only > lowercase letters in a custom namespace. Is there any reason that > something like the patch below can't be done? > > > --- old/lib/XML/RSS.pm 2009-08-03 20:52:49.000000000 -0400 > +++ new/lib/XML/RSS.pm 2009-08-03 20:52:49.000000000 -0400 > @@ -386,8 +386,8 @@ > my $self = shift; > my $hash = {@_}; > > - $hash->{prefix} =~ /^[a-z_][a-z0-9.\-_]*$/ > - or croak "a namespace prefix should look like
[a-z_][a-z0-9.\\-_]*"; Show quoted text
> + $hash->{prefix} =~ /^[a-z_][a-z0-9.\-_]*$/i > + or croak "a namespace prefix should look like > [A-Za-z_][A-Za-z0-9.\\-_]*"; > > $hash->{uri} > or croak "a URI must be provided in a namespace declaration"; >
Hi! Thanks for your report. The proper standard is: http://www.w3.org/TR/REC-xml-names/ And it seems to agree with you, at least according to my understanding of it. (It also seems to support some unicode characters as valid letters in identifiers). In any case, please add a regression test - patch one of the files under t/*.t. Regards, Shlomi Fish
I'm not a module developer, so I've never tried anything like what you've requested before. So apologies if I did it wrong. I grabbed a couple of files in the "t" directory and hopefully grokked enough of the syntax to add a couple of new tests. These tests FAIL with the RSS.pm code as it is, and PASS when RSS.pm is changed to allow uppercase letters... so I guess the tests are working.
Download RSS.pm_patch
application/octet-stream 529b

Message body not shown because it is not plain text.

Download 1.0-generate.t_patch
application/octet-stream 1.2k

Message body not shown because it is not plain text.

Download 2.0-modules.t_patch
application/octet-stream 604b

Message body not shown because it is not plain text.