note 41860 added to ref.simplexml
| From: | manicdepressive at mindless dot com | Date: | Fri, 23 Apr 2004 22:13:20 +0000 |
| Subject: | note 41860 added to ref.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68696@lists.php.net to get a copy of this message | ||
I had to make adjustments to get the above 'Setting Values' example to work on WindowsXP
with PHP5rc4: I changed the 'path' to follow more accurately the structure of the
document, which it does not appear to do in the example. Also, thus far with my installation it
appears that you can only set values of preexisting nodes ('name'), and not add a new node
('age').
<?php
$xml->movie[0]->actor[0]->age = '21'; // didn't work -- throws fatal error
$xml->movie[0]->characters[0]->character[0]->age = '21' ; // didn't work
$xml->movie[0]->characters[0]->character[0]->name = 'BEAVIS'; //works
?>
code till dawn! mark meves!
----
Manual Page -- http://www.php.net/manual/en/ref.simplexml.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41860
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41860&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41860&report=yes
Search -- http://master.php.net/manage/user-notes.php