note 108936 modified in simplexmlelement.addchild by danbrown
| From: | danbrown@php.net | Date: | Wed, 06 Jun 2012 17:49:21 +0000 |
| Subject: | note 108936 modified in simplexmlelement.addchild by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188428@lists.php.net to get a copy of this message | ||
I found myself doing something
like: <?php $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: <?php $cn =
$contentNode->$name = ""; $cn =
$contentNode->$name; ?> hope
will help someone else.
--was--
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.
http://php.net/manual/en/simplexmlelement.addchild.php