note 96822 deleted from simplexmlelement.addChild by danbrown

From: Date: Fri, 28 Jan 2011 14:34:14 +0000
Subject: note 96822 deleted from simplexmlelement.addChild by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176453@lists.php.net to get a copy of this message
Note Submitter: Lutz Elsner ---- 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); } } ?>

« previous php.notes (#176453) next »