Skip Menu |

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

Report information
The Basics
Id: 67268
Status: resolved
Priority: 0/
Queue: XML-FeedPP

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

Bug Information
Severity: Important
Broken in: 0.42
Fixed in: (no value)



Subject: Wrong return value of description() with xhtml content in atom feeds
Hi, it seems that are some locale specific bytes in a regex to filter out the content of a xhtml element in atom feeds. Without a lot of research i suppose there's a JIS fullwidth backslash. After replacing them with ascii backslashes, description() works, but returns a xml data structure as hash reference. I fixed this with generating a new XML::TreePP and write() it, but i'm no sure if this is really the most elegant solution. Is there any reason to return the hash reference? Returning a string seems to be the expected result. Best wishes, Mario
Subject: hack_for_atom_content_xhtml.diff
diff --git a/lib/XML/FeedPP.pm b/lib/XML/FeedPP.pm index 0bca101..68c5396 100644 --- a/lib/XML/FeedPP.pm +++ b/lib/XML/FeedPP.pm @@ -2236,8 +2236,10 @@ sub get_value { if ( UNIVERSAL::isa( $value, 'HASH' ) && exists $value->{'-type'} && ($value->{'-type'} eq "xhtml")) { - my $child = [ grep { /^[^_-_#]/ } keys %$value ]; + my $child = [ grep { /^[^\#\-]/ } keys %$value ]; if (scalar @$child == 1) { + my $tpp = XML::TreePP->new( xml_decl => '' ); + return $tpp->write( get_value( $value, $child->[0] ) ); return &get_value( $value, $child->[0] ); } }
fixed on version 0.43. thank you again. http://www.kawa.net/works/perl/feedpp/feedpp-e.html Show quoted text
> my $child = [ grep { /^[^\#\-]/ } keys %$value ];
The patch was applied. Show quoted text
> my $tpp = XML::TreePP->new( xml_decl => '' ); > return $tpp->write( get_value( $value, $child->[0] ) );
this hack looks nice, however, is not applied due to backward compatibility and out of concern of confusion. XML::TreePP could not make round-trip with XHTML structure, in fact. for example, order of elements and multiple text nodes.