note 108936 added to simplexmlelement.addchild
| From: | pierpaolog at gmail dot com | Date: | Wed, 06 Jun 2012 14:33:22 +0000 |
| Subject: | note 108936 added to simplexmlelement.addchild | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188423@lists.php.net to get a copy of this message | ||
I found myself doing something like:
<?
$cn = $contentNode->$name;
?>
and keep getting an error message like:
Warning: SimpleXMLElement::addChild(): Cannot add child. Parent is not a permanent member of the XML
tree
I found out that what I needed to do to make the node permanent was:
<?
$cn = $contentNode->$name = "";
$cn = $contentNode->$name;
?>
hope will help someone else.
----
Server IP: 81.88.49.34
Probable Submitter: 2.229.4.207
----
Manual Page -- http://www.php.net/manual/en/simplexmlelement.addchild.php
Edit -- https://master.php.net/note/edit/108936
Del: integrated -- https://master.php.net/note/delete/108936/integrated
Del: useless -- https://master.php.net/note/delete/108936/useless
Del: bad code -- https://master.php.net/note/delete/108936/bad+code
Del: spam -- https://master.php.net/note/delete/108936/spam
Del: non-english -- https://master.php.net/note/delete/108936/non-english
Del: in docs -- https://master.php.net/note/delete/108936/in+docs
Del: other reasons-- https://master.php.net/note/delete/108936
Reject -- https://master.php.net/note/reject/108936
Search -- https://master.php.net/manage/user-notes.php