Re: Troubles with importing a node from another DOMDocument
| From: | Derick Rethans | Date: | Thu, 17 Jul 2008 09:34:13 +0000 |
| Subject: | Re: Troubles with importing a node from another DOMDocument | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-610@lists.php.net to get a copy of this message | ||
On Thu, 17 Jul 2008, Stanislav Sazonov wrote:
> 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);
> ?>
<snip>
> I wonder, how can i solve this problem?
You need to import the node in the new document:
http://no.php.net/manual/en/domdocument.importnode.php
regards,
Derick