[xml] xmlNodeGetContent() bug?
- From: Alexander Grimalovsky <flying dom natm ru>
- To: xml gnome org
- Subject: [xml] xmlNodeGetContent() bug?
- Date: Thu, 12 Jun 2003 18:32:48 +0400
Hello,
I found some strange behaviour of xmlNodeGetContent() function,
handling XML entities.
For me it simply substitutes any XML entity reference node with empty
string instead of its value (however comments for this function in
libxml2 sources have these words: "Entity references are substituted").
Here is example file (in PHP, but get_content() function have nothing
more then call of xmlNodeGetContent() in it)
<?php
$xml = xmldoc('<?xml version="1.0"?><root/>');
$root = $xml->root();
$root->append_child($xml->create_entity_reference('A'));
$root->append_child($xml->create_text_node('text_1'));
$root->append_child($xml->create_entity_reference('B'));
$root->append_child($xml->create_text_node('text_2'));
$root->append_child($xml->create_entity_reference('C'));
echo $root->get_content();
?>
This example returns me:
text_1text_2
instead of expected:
Atext_1Btext_2C
However dumping of same node returns expected:
Atext_1Btext_2C
And checking of <root> node childs shows, that there is 5 childs - 2
nodes and 3 entity references.
Tested with versions 2.4.28 and 2.5.7 of libxml2 with same result.
--
Best regards,
Alexander mailto:flying dom natm ru
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]