ID: 26202
Updated by: [email]chreguphp.net[/email]
-Summary: DomNode->set_content() method does not work propertly
Reported By: michael_makarov at hotmail dot com
-Status: Open
+Status: Wont fix
Bug Type: DOM XML related
-Operating System: Windows XP Professional SP1
+Operating System: Linux
-PHP Version: 4.3.4
+PHP Version: 4.3.3
New Comment:

Just don't use set_content if you want reliable results. It's buggy as
hell ;)

create_text_node()/append_child() is the better approach

chregu


Previous Comments:
------------------------------------------------------------------------

[2003-11-11 09:41:04] michael_makarov at hotmail dot com

code below works fine, but i don`t understand why i need
get child node for replacing content?
<?
$dom = domxml_open_mem("<?xml version=\"1.0\"
encoding=\"UTF-8\"?><Test>String1</Test>");
$node = $dom->doent_element();
$cn = $node->first_child();
$cn->set_content("String2");
echo $dom->dump_mem();
?>

------------------------------------------------------------------------

[2003-11-11 09:31:03] michael_makarov at hotmail dot com

Description:
------------
set_content() method does not replace node content
now it`s look like
new content = old content + function argument

this is not:
Bug #19247
Bug #23710




Reproduce code:
---------------
<?
$dom = domxml_open_mem("<?xml version=\"1.0\"
encoding=\"UTF-8\"?><Test>String1</Test>");
$node = $dom->doent_element();
$node->set_content("String2");
echo $dom->dump_mem();
?>



Expected result:
----------------
<?xml version=\"1.0\" encoding=\"UTF-8\"?><Test>String2</Test>

Actual result:
--------------
<?xml version=\"1.0\" encoding=\"UTF-8\"?><Test>String1String2</Test>


------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=26202&edit=1[/url]