SimpleXMLElement writing problem while in a reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
I found out (while playing with xpath()) that you cant edit the content of a node when you use a reference on a SimpleXMLElement object.
An example:
---------------------------
$xmlString = '<?xml version="1.0" encoding="UTF-8"?> 
  <container>
   <texte>
    <text user="user1">llllasdfasdfeorpqi</text>
    <text user="user2">oouzzrrzreorpqi</text>
  </texte> 
</container>';

$xml = simplexml_load_string($xmlString);
$xml->texte->text[0] = 'newText'; // Works
$xml->texte->text[0]['user'] = 'newUser'; // Works
echo $xml->asXML() . "\n";

$xml = simplexml_load_string($xmlString);
$xmlRef = $xml->texte->text[0]; // Creating a reference
$xmlRef['user'] = 'newUser'; // Works
$xmlRef = 'newUser'; // Doesnt Work!
echo $xml->asXML() . "\n";
---------------------------
Am i doing something wrong. or is this a bug or what ?

Hope for some help

Bye
Georg Nagel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux