note 89644 added to function.simplexml-element-addChild
| From: | ldmc at yahoo dot com | Date: | Tue, 17 Mar 2009 18:14:31 +0000 |
| Subject: | note 89644 added to function.simplexml-element-addChild | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152059@lists.php.net to get a copy of this message | ||
Simple way to add a text node:
$x=simplexml_load_string('<test />');
$x->addAttribute('id','x01');
$x[0]='text node';
echo $x->asXML();
Result:
<?xml version="1.0"?>
<test id="x01">text node</test>
Any numeric array subscript (in this case 0) will work.
----
Server IP: 69.147.83.197
Probable Submitter: 119.95.203.179
----
Manual Page -- http://www.php.net/manual/en/function.simplexml-element-addChild.php
Edit -- https://master.php.net/note/edit/89644
Del: integrated -- https://master.php.net/note/delete/89644/integrated
Del: useless -- https://master.php.net/note/delete/89644/useless
Del: bad code -- https://master.php.net/note/delete/89644/bad+code
Del: spam -- https://master.php.net/note/delete/89644/spam
Del: non-english -- https://master.php.net/note/delete/89644/non-english
Del: in docs -- https://master.php.net/note/delete/89644/in+docs
Del: other reasons-- https://master.php.net/note/delete/89644
Reject -- https://master.php.net/note/reject/89644
Search -- https://master.php.net/manage/user-notes.php