Troubles with importing a node from another DOMDocument
| From: | Stanislav Sazonov | Date: | Thu, 17 Jul 2008 08:44:58 +0000 |
| Subject: | Troubles with importing a node from another DOMDocument | ||
| Groups: | php.xml.dev | ||
| Request: | Send a blank email to php-xml-dev+get-609@lists.php.net to get a copy of this message | ||
Hi!
I have a trouble with importing a node from one DOMDocument to another. I
have no troubles with MSXML lib, but during porting my sourcecode to PHP i
faced this:
<?
$xml = new DOMDocument('1.0', 'utf-8');
$xml2 = new DOMDocument('1.0', 'utf-8');
$el = $xml->createElement("smth");
$el2 = clone $el;
$xml2->appendChild($el2);
?>
OUTPUT:
Fatal error: Uncaught exception 'DOMException' with message 'Wrong Document
Error' in D:\www\joomla\libraries\bc\2.php:9
Stack trace:
#0 D:\www\joomla\libraries\bc\2.php(9):
DOMNode->appendChild(Object(DOMElement))
#1 {main}
thrown in D:\www\joomla\libraries\bc\2.php on line 9
I wonder, how can i solve this problem?