Re: merge two domDocuments

From: Date: Thu, 20 May 2004 17:51:30 +0000
Subject: Re: merge two domDocuments
References: 1  Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-373@lists.php.net to get a copy of this message
On Mon, 17 May 2004, Arno Mittelbach wrote: > /* append domdocB to A */ > $oRootB = $oDomDocB->documentElement; > $oToAppend = $oDomDocA->importNode( $oRootB ); > $oRoot->appendChild( $oToAppend ); > > Everything works fine, but only the first level of $oDomDocB is 'included' > (probably appendChild includes just the first level and no grandchildren). > Is there a way to 'adopt' an Element with all its children or do I have to > do this recursively? Pass true as the second parameter to importNode(): $oToAppend = $oDomDocA->importNode( $oRootB, true ); -adam -- adam@trachtenberg.com author of o'reilly's php cookbook avoid the holiday rush, buy your copy today!

« previous php.xml.dev (#373) next »