note 96822 added to simplexmlelement.addChild

From: Date: Wed, 17 Mar 2010 15:48:38 +0000
Subject: note 96822 added to simplexmlelement.addChild
Groups: php.notes 
Request: Send a blank email to php-notes+get-167137@lists.php.net to get a copy of this message
If You want to add another XML-Element as shown former by Anonymous, but also want to consider the attributes, extend the given function as shown: <?php function AddXMLElement(SimpleXMLElement $dest, SimpleXMLElement $source) { $new_dest = $dest->addChild($source->getName(), $source[0]); foreach ($source->attributes() as $name => $value) { $new_dest->addAttribute($name, $value); } foreach ($source->children() as $child) { AddXMLElement($new_dest, $child); } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 93.200.52.55 ---- Manual Page -- http://www.php.net/manual/en/simplexmlelement.addChild.php Edit -- https://master.php.net/note/edit/96822 Del: integrated -- https://master.php.net/note/delete/96822/integrated Del: useless -- https://master.php.net/note/delete/96822/useless Del: bad code -- https://master.php.net/note/delete/96822/bad+code Del: spam -- https://master.php.net/note/delete/96822/spam Del: non-english -- https://master.php.net/note/delete/96822/non-english Del: in docs -- https://master.php.net/note/delete/96822/in+docs Del: other reasons-- https://master.php.net/note/delete/96822 Reject -- https://master.php.net/note/reject/96822 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167137) next »