Subject: | XML::Liberal causes XML::Feed item summaries to be set to MagicElements? |
I'm using XML::Liberal 0.3 in conjunction with XML::Feed 0.52 with perl 5.16.3 on CentOS 6.4.
The following script should show the issue I'm encountering.
XML::Feed sets $item->summary->body to a simple scalar string.
If I set $XML::Feed::Format::RSS::PREFERRED_PARSER to "XML::RSS::LibXML", then
the summary->body is set to a XML::RSS::LibXML::MagicElement object.
Is this the correct behavior?
my $data = <<END_DATA;
<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spe\
c/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:\
georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' x\
mlns:thr='http://purl.org/syndication/thread/1.0' version='2.0'>
<channel>
<title>FEED TEST</title>
<link>http://example.com/</link>
<description>Dummy Data</description>
<item>
<title>DUMMY TITLE</title>
<atom:summary type='text'>DUMMY TEXT</atom:summary>
<link>http://example.com/example.html</link>
</item>
</channel>
</rss>
END_DATA
;
use XML::Feed;
use XML::Liberal;
use Data::Dumper;
TestTrunc();
print "\n", '-'x50, "\n";
$XML::Feed::Format::RSS::PREFERRED_PARSER = "XML::RSS::LibXML";
TestTrunc();
sub TestTrunc {
my $feed = XML::Feed->parse(\$data);
for my $item ($feed->entries) {
print Dumper($item->summary->body);
}
}