Subject: | getString/extractText ignore entity references |
The extractText method ignores entity references when concat'ing child nodes.
use XML::EasyOBJ;
$xml = <<XML;
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<person><name>John Rodríguez</name></person>
XML
$doc = new XML::EasyOBJ(-type=>'string', -param=>$xml);
print $doc->name->getString(), "\n";
$ perl test-entities.pl
John Rodrguez
--- XML/EasyOBJ.pm.old 2005-08-11 22:56:12.000000000 +0100
+++ XML/EasyOBJ.pm 2005-08-11 22:33:44.000000000 +0100
@@ -366,6 +366,9 @@
if ( $n->getNodeType == TEXT_NODE ) {
$text = $n->toString;
}
+ elsif ( $n->getNodeType == ENTITY_REFERENCE_NODE ) {
+ $text = $n->toString;
+ }
elsif ( $n->getNodeType == ELEMENT_NODE ) {
foreach my $c ( $n->getChildNodes ) {
$text .= &{$INTSUBLIST{extractText}}( $c );