I use this code to create a new node with the expected output:
<item desc="desc foobar"><![CDATA[qux]]></item>
the code:
open my $fh, "<", $xml_file; binmode $fh; my $parser = XML::LibXML->new(); my $doc = $parser->load_xml(IO => $fh);
it works well for creating texts of new elements, but I'm wondering how to add CDATA without replacing XML entities: I get:
<item desc="dddd"><![CDATA[qux]]>
source share