note 56571 added to ref.simplexml

From: Date: Wed, 07 Sep 2005 19:51:29 +0000
Subject: note 56571 added to ref.simplexml
Groups: php.notes 
Request: Send a blank email to php-notes+get-94872@lists.php.net to get a copy of this message
While you can't add new elements to a SimpleXML object you can however add new attributes <?php $string = '<doc channel="chat"><test1>Hello</test1></doc>'; $xml = simplexml_load_string($string); $xml->test1['sub'] = 'No'; echo $xml->asXML(); ?> Will return output <doc channel="chat"><test1 sub="No">Hello</test1></doc> ---- Manual Page -- http://www.php.net/manual/en/ref.simplexml.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56571 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56571&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56571&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56571&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56571&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56571&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56571&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56571&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94872) next »