Subject: | wrong handling enclosure subelement of item |
According to rss 2.0 specification, 'enclosure' - subelement
of 'item' - is an empty xml-element with few attributes.
F.e.:
<enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3"
length="12216320" type="audio/mpeg" />
XML::RSS looses all attributes of this element. Here is the quick
patch to fix this:
*** RSS_original.pm 2006-03-12 02:47:19.000000000 +0300
--- RSS.pm 2006-09-27 12:29:41.000000000 +0400
*************** sub handle_start {
*** 1505,1510 ****
--- 1505,1515 ----
push(@{$self->{'items'}->[$self->{num_items}-1]->
{'taxo'}},$attribs{'resource'});
$self->{'modules'}->
{'http://purl.org/rss/1.0/modules/taxonomy/'} = 'taxo';
+ # beginning of enclosure element in item
+ } elsif ($el eq 'enclosure' && $self->within_element('item')) {
+
+ $self->{'items'}->[$self->{num_items}-1]->{'enclosure'} = {map
{$_ => $attribs{$_}} keys %attribs};
+
# beginning of taxo li in channel element
} elsif ($self->within_element($self->generate_ns_name
("topics",'http://purl.org/rss/1.0/modules/taxonomy/'))
&& $self->within_element($self->generate_ns_name
("channel",$self->{namespace_map}->{'rss10'}))
Subject: | RSS.pm.patch |
*** RSS_original.pm 2006-03-12 02:47:19.000000000 +0300
--- RSS.pm 2006-09-27 12:29:41.000000000 +0400
*************** sub handle_start {
*** 1505,1510 ****
--- 1505,1515 ----
push(@{$self->{'items'}->[$self->{num_items}-1]->{'taxo'}},$attribs{'resource'});
$self->{'modules'}->{'http://purl.org/rss/1.0/modules/taxonomy/'} = 'taxo';
+ # beginning of enclosure element in item
+ } elsif ($el eq 'enclosure' && $self->within_element('item')) {
+
+ $self->{'items'}->[$self->{num_items}-1]->{'enclosure'} = {map {$_ => $attribs{$_}} keys %attribs};
+
# beginning of taxo li in channel element
} elsif ($self->within_element($self->generate_ns_name("topics",'http://purl.org/rss/1.0/modules/taxonomy/'))
&& $self->within_element($self->generate_ns_name("channel",$self->{namespace_map}->{'rss10'}))