#29426 [Com]: Incomplete/inconsistent functionality
| From: | cyberlot at cyberlot dot net | Date: | Sat, 07 Aug 2004 23:18:55 +0000 |
| Subject: | #29426 [Com]: Incomplete/inconsistent functionality | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64240@lists.php.net to get a copy of this message | ||
ID: 29426
Comment by: cyberlot at cyberlot dot net
Reported By: php at peterrobins dot co dot uk
Status: Open
Bug Type: SimpleXML related
Operating System: Linux 2.4
PHP Version: 5.0.0
New Comment:
Confirming this bug exists, Have the same problem, I need to add to a
simplexml object on the fly and can't
Previous Comments:
------------------------------------------------------------------------
[2004-07-28 13:22:59] php at peterrobins dot co dot uk
Description:
------------
According to the manual page, you can add a node with
SimpleXML, but this does not seem to work, either as
$xml->movie[0]->characters[0]->character[0]->age = '21';
nor as
$xml->movie[0]->rating[2] = 'not bad';
Deletion works on attributes
unset($xml->movie[0]->rating[1]['type']);
but at node level, deletes all
unset($xml->movie[0]->rating);
This is inconsistent with reading where
$xml->movie[0]->rating
fetches the first node only.
unset($xml->movie->rating);
deletes all ratings for the 1st movie only.
It does not appear possible to delete just 1 node
unset($xml->movie[0]->rating[1]);
Because objs are now refs not copies, can do this
$rat = $xml->movie[0]->rating[0];
$rat['name'] = 'judge';
but not this
$rat = 'new content';
nor this
$rat->child[0] = 'new rating';
and if I try and do
$rat->child = 'new rating';
I get 'Attempt to assign property of non-object'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29426&edit=1