CC: | erich.weigand [...] nureg.de |
Subject: | encoding of ampersant |
XML::LibXML very conveniently encodes entities. However, for some
reason not for createAttribute(): then it complains with "unterminated
entity reference". Using setAttribute() works as expected.
Bug or feature?
(libxml2 v2.7.1 and 2.7.3)
use XML::LibXML;
my $doc = XML::LibXML::Document->new;
my $elem = $doc->createElement('myelem');
$elem->appendText('c & d');
$elem->setAttribute(myattr => 'a & b');
my $attr = $doc->createAttribute(attr2 => 'e & f');
$elem->addChild($attr);
print $elem->toString(1);