On Tue, 22 Feb 2005 15:02:38 +0200
Sergio Gorelyshev <[EMAIL PROTECTED]> wrote:
It's work!!! :-) Thanks. 
Here is a valid code:
<?php                                                                           
                       
$dom = new DomDocument();                                                       
                       
$dom->appendChild(($root = $dom->createElement("test1")));                      
                       
                                                                                
                       
$dom2 = new DomDocument();                                                      
                       
$dom2->appendChild(($root2 = $dom2->createElement("test2")));                   
                       
                                                                                
                       
$dom->appendChild($dom->importNode($dom2->childNodes->item(0));
var_dump($dom->saveXML());                                                      
                       
?>

The result is:
string(40) "<?xml version="1.0"?>
<test1/>
<test2/>
"

> On Tue, 22 Feb 2005 06:58:12 -0500
> Yann Larrivee <[EMAIL PROTECTED]> wrote:
> 
> > Hi Sergio maybe you should have a look at importNode 
> > http://ca3.php.net/manual/en/function.dom-domdocument-importnode.php
> I've been tried to use this function. There are no results.  This function 
> (as well as appendChild() ) requires parameter of DOMNode type. But root 
> element of DOMDocument object is DOMElement. Any attempt to use it as DOMNode 
> (while it is successor of DOMNode) becomes as fail. No errors. No results. 
> Nothing.
> 
> Sample code:
> <?php                                                                         
>                          
> $dom = new DomDocument();
> $dom->appendChild(($root = $dom->createElement("test1")));
>                                                                               
>                          
> $dom2 = new DomDocument();
> $dom2->appendChild(($root2 = $dom2->createElement("test2")));
> 
> $dom->importNode($dom2->childNodes->item(0));
> var_dump($dom->saveXML());
> ?>
> Result is: 
> 
> string(31) "<?xml version="1.0"?>
> <test1/>
> "
> 
> >
> > I beleive this is what you need along with Normalize.
> > Good luck.
> > Yann
> > 
> > On Tuesday 22 February 2005 06:54, Sergio Gorelyshev wrote:
> > > Hi to all. I have a problem. I need to "glue" 2 or more DomDocument?
> > > objects to one. After hours of hard coding I've came to the conclusion 
> > > that
> > > there is no possibility to use  PHP 5.3.0 to realize it.  Is there anybody
> > > who could break this conclusion and give me an appropriate solution?
> > >
> > > P.S. I did it with PHP 5.1.0 cvs version and I used a small trick.
> > >
> > > Thanks.
> > > --
> > > RE5PECT
> > > Sergio Gorelyshev
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> 
> -- 
> RE5PECT
> Sergio Gorelyshev
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
RE5PECT
Sergio Gorelyshev

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to