Subject: | Warning on CDATA |
XML::LibXML::PrettyPrinter generates carps if there is a cdata section:
#!/usr/bin/perl -w
use strict;
use XML::LibXML;
use XML::LibXML::PrettyPrint;
my $doc = XML::LibXML->createDocument();
my $node = XML::LibXML::Element->new('Top');
my $cdata = $doc->createCDATASection( q{Strunk &
white});
$doc->addChild($node);
$node->addChild($cdata);
my $pp = XML::LibXML::PrettyPrint->new(indent_string => " ");
$pp->pretty_print($doc);
print $doc->toString;
This gives:
Don't know how to handle XML::LibXML::CDATASection object at
U:\temp\scripts\pp.pl line 14
<?xml version="1.0"?>
<Top>
<![CDATA[Strunk &
white]]>
</Top>
However, the XML appears to be what I'd expect after being prettified,
even if I add more nested nodes. Maybe XML::LibXML::CDATASection
objects should be ignored....