Re: PHP5 DOM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 22 Feb 2005 06:58:12 -0500
Yann Larrivee <yannl@xxxxxxxxx> 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux