note 28916 added to function.domnode-append-child
| From: | Blah at rack1 dot php dot net | Date: | Tue, 28 Jan 2003 03:14:10 +0000 |
| Subject: | note 28916 added to function.domnode-append-child | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42900@lists.php.net to get a copy of this message | ||
As of PHP 4.3.0, DomXml apparently no longer allows you to use append_child to insert a node from
one document into another. For example:
$doc1 = domxml_open_mem($xmlstr1);
$doc2 = domxml_open_mem($xmlstr2);
$root1= $doc1->document_element();
$root2= $doc2->document_element();
// Before PHP 4.3.0, combining the documents was as simple
// as this:
// $root1->append_child($root2);
// Now, you must first clone the node(and its children)
$copiedNode = $root2->clone_node(true);
$root1->append_child($copiedNode);
$outputXML = $root1->dump_mem(true);
---
A small change, and maybe that was always the correct way, but it got me so I thought I would share.
--
http://www.php.net/manual/en/function.domnode-append-child.php
http://master.php.net/manage/user-notes.php?action=edit+28916
http://master.php.net/manage/user-notes.php?action=delete+28916
http://master.php.net/manage/user-notes.php?action=reject+28916