note 84744 rejected from ref.simplexml by thiago

From: Date: Mon, 28 Jul 2008 14:34:44 +0000
Subject: note 84744 rejected from ref.simplexml by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142849@lists.php.net to get a copy of this message
Note Submitter: shivakumar dot rnm at gmail dot com ---- Hi All, I have a written a method in SimpleXML parser to update node value for xml file. my method does updates node value but it deletes all the child nodes for it. I want to avoid the deleting of child nodes. If u have method for updating node plz send it to me. my xml file, <?xml version="1.0" encoding="UTF-8"?> <root> <q1.php language="fr|pt|en|in" editable="Yes">Description<array1 language="fr|pt|en|in" editable="Yes" type="Array" index="Yes">Comment</array1></q1.php></root> this is my method , <?php $xml = simplexml_load_file('shiva.xml'); $result = $xml->xpath('/root'); $file = 'q1.php'; $result[0]->$file = 'modified'; $fp = @fopen('shiva.xml', "w+"); @fwrite($fp, $xml->asXML()); @fclose($fp); ?> this is output i'm getting <?xml version="1.0" encoding="UTF-8"?> <root> <q1.php language="fr|pt|en|in" editable="Yes">modified</q1.php></root> plz reply me ASAP

« previous php.notes (#142849) next »