Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

DomNode->clone_node

(no version information, might be only in CVS)

DomNode->clone_node --  Clones a node

Описание

domelement DomNode->clone_node ( void )

Внимание

К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.



DomNode->dump_node> <DomNode->child_nodes
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
DomNode->clone_node
sworley at dotster dot com
21-Nov-2006 02:00
A complete, executable, minimal example of how to copy between documents:

<?
$doc1 = domxml_open_mem('<one><onething/></one>');
$doc2 = domxml_open_mem('<two><twothing/></two>');
$root1 = $doc1->document_element();
$root2 = $doc2->document_element();
$root1->append_child($root2->clone_node(true));
echo $doc1->dump_mem();
?>

Emits: <one><onething/><two><twothing/></two></one>
krymsonwulf at gmail dot com
05-Jun-2006 02:41
It seems like this function is non-recursive: cloning a node will not clone it's child nodes in my experience
andrew at transitionmedia dot co dot uk
12-Feb-2006 07:04
As of version 4.3 PHP doesn't support Appending a child from another source document. If you are trying to  import information from multiple sources into a final document [for transformation using XSL as an example] then you can have problems. This technique can be used to do it though.

I am assuming you have two documents open, $xmldoc1 and $xmldoc2 and you have selected [via XPath or explicit searching] the nodes you want in each document. Thus $xmldoc1_appending_node is the node you would like to add $xmldoc2_importnode to.

<?

// first we create a temporary node within the document we want to add to.
$temp_importnode = $xmldoc1->create_element("import");

// now we have a node that is in the right document context we can clone the one we want into this one.
$temp_importnode = $xmldoc_importnode->clone_node(true);

// by using true in the above call to clone_node() we copy all of the child nodes as well. Use false or nothing if you just want the containing node with no children.

$xmldoc1_appending->append_child($importnode);

?>

Now your document contains the new nodes imported from a different document.
hrz at geodata dot soton dot ac dot uk
11-May-2005 08:28
Passing boolean 'true' as the argument to this function will result in all child nodes being cloned as well.
r dot kamstra at syntomax dot com
08-Nov-2002 08:06
if a DomNode is duplicated it's siblings and parent are not duplicated

DomNode->dump_node> <DomNode->child_nodes
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571