note 119144 added to simplexmlelement.addattribute

From: Date: Sun, 10 Apr 2016 10:37:59 +0000
Subject: note 119144 added to simplexmlelement.addattribute
Groups: php.notes 
Request: Send a blank email to php-notes+get-205192@lists.php.net to get a copy of this message
You cannot use this to update an existing attribute's value. Instead, get a DOM version of the SimpleXMLElement and use setAttribute, as per: $XML = '<element a="aa">Text</element>'; $snode = new simple_xml_element($XML); $dnode = dom_import_simplexml($snode); $dnode->setAttribute('a', 'bb'); Resulting XML for the node is: <element a="bb">Text</element> ---- Server IP: 72.52.91.14 Probable Submitter: 14.202.27.215 ---- Manual Page -- http://php.net/manual/en/simplexmlelement.addattribute.php Edit -- https://master.php.net/note/edit/119144 Del: integrated -- https://master.php.net/note/delete/119144/integrated Del: useless -- https://master.php.net/note/delete/119144/useless Del: bad code -- https://master.php.net/note/delete/119144/bad+code Del: spam -- https://master.php.net/note/delete/119144/spam Del: non-english -- https://master.php.net/note/delete/119144/non-english Del: in docs -- https://master.php.net/note/delete/119144/in+docs Del: other reasons-- https://master.php.net/note/delete/119144 Reject -- https://master.php.net/note/reject/119144 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205192) next »