You are here: Re: [PHP] PHP5 DOM « PHP « IT news, forums, messages
Re: [PHP] PHP5 DOM

Posted by Sergio Gorelyshev on 02/22/05 15:02

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация