note 84532 deleted from simplexmlelement.addChild by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Jan 2011 14:34:30 +0000 |
| Subject: | note 84532 deleted from simplexmlelement.addChild by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176461@lists.php.net to get a copy of this message | ||
Note Submitter: essen at dev-extend dot eu
----
Easy and fast deleting of a node:
<?php
$oNode = dom_import_simplexml($oSimpleXMLNodeToDelete);
$oNode->parentNode->removeChild($oNode);
?>
The node can have childs, attributes, and be anywhere in your document, it'll get deleted. The
deletion will appear immediately in your SimpleXML object after calling removeChild, there's
nothing else to do.