Skip Menu |

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

Report information
The Basics
Id: 6760
Status: resolved
Priority: 0/
Queue: XML-RAI

People
Owner: Nobody in particular
Requestors: richardjolly [...] mac.com
Cc:
AdminCc:

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



Subject: Breaks on <item xmlns="">
# distribution XML::RAI 0.51 # bug Parsing an rdf with "<item xmlns="">" tags in it causes the following error when trying to call a method on an XML::RAI::Item object: # error message Can't call method "query" on an undefined value at /opt/local/lib/perl5/site_perl/5.8.4/XML/RAI/Object.pm line 38. # test case Show quoted text
> cat rss-bug.pl
#!/usr/bin/perl use strict; use warnings; use XML::RAI; use LWP::UserAgent; my $url = 'http://www.newscientist.com/syndication/news.rdf'; my $ua = LWP::UserAgent->new; my $request = new HTTP::Request( 'GET', $url ); my $response = $ua->request($request); my $content = $response->content; # uncommenting allows script to complete #$content =~ s/<item xmlns="">/<item>/g; my $rai = XML::RAI->parse( $content ); print scalar $_->title for @{$rai->items}; __END__ # perl version Show quoted text
>perl -v
This is perl, v5.8.4 built for darwin-2level Show quoted text
>uname -a
Darwin noras-computer.local 7.3.0 Darwin Kernel Version 7.3.0: Fri Mar 5 14:22:55 PST 2004; root:xnu/xnu-517.3.15.obj~4/RELEASE_PPC Power Macintosh powerpc # patch beyond my abilities! But thanks for the very helpful module
From: tima
I've never seen a feed formatted this way and I'm looking into this one further before acting. I have posted a message to RSS-DEV over the unusal if not invalid use of the default namespace in this feed. This feed's default (RSS) namespace is http://my.netscape.com/rdf/simple/0.9/ which means these items, according to the XML Namespace specification, are not RSS items because the default namespace is set to "" (empty string). I should be handling no item feeds (that's a bug thanks), BUT even once I fix that you still wouldn't get any items as RAI would think those items are some extension it doesn't know about. This is my understanding of the specifications, however I am testing them since I could be wrong. <tim/>