note 98993 added to simplexmlelement.addChild
| From: | dal-pa_c at epitech dot eu | Date: | Wed, 21 Jul 2010 08:31:41 +0000 |
| Subject: | note 98993 added to simplexmlelement.addChild | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171004@lists.php.net to get a copy of this message | ||
If You want to add another XML-Element as shown former by "Lutz Elsner", but also want to
consider the NameSpace, extend the given function as shown:
public function AddXMLElement(SimpleXMLElement $dest, SimpleXMLElement $source, $ns = NULL)
{
$new_dest = $dest->addChild($source->getName(), $source[0], $ns);
foreach ($source->attributes($ns) as $name => $value)
{
$new_dest->addAttribute($name, $value, $ns);
}
foreach ($source->children($ns) as $child)
{
AddXMLElement($new_dest, $child, $ns);
}
}
----
Server IP: 89.31.146.176
Probable Submitter: 80.14.206.74
----
Manual Page -- http://www.php.net/manual/en/simplexmlelement.addChild.php
Edit -- https://master.php.net/note/edit/98993
Del: integrated -- https://master.php.net/note/delete/98993/integrated
Del: useless -- https://master.php.net/note/delete/98993/useless
Del: bad code -- https://master.php.net/note/delete/98993/bad+code
Del: spam -- https://master.php.net/note/delete/98993/spam
Del: non-english -- https://master.php.net/note/delete/98993/non-english
Del: in docs -- https://master.php.net/note/delete/98993/in+docs
Del: other reasons-- https://master.php.net/note/delete/98993
Reject -- https://master.php.net/note/reject/98993
Search -- https://master.php.net/manage/user-notes.php