Re: how to edit a xml file
| From: | Diego do Nascimento Feitosa | Date: | Sat, 09 Sep 2006 03:35:46 +0000 |
| Subject: | Re: how to edit a xml file | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7234@lists.php.net to get a copy of this message | ||
suomaf escreveu:
Hello all, I think this is a php question again, but i can't seem to find information on how to edit a xml after reading it in. <?xml version="1.0"?> <toDoList> <task> <id>1</id> <done>0</done> <toDo>try to finish this to do list</toDo> <priority>Normal</priority> <date>8-2-2006</date> </task> <task> <id>2</id> <done>0</done> <toDo>so this is a new take... wasssssuppp!!!!!!!!!!1~</toDo> <priority>ASAP</priority> <date>8-3-2006</date> </task> </toDoList> I would like to be able to read in task->id=1 and change done from 0 to 1 and then write back to the xml file... All the simplexml documentation i have been reading at the moment is teaching me how to read it and not write it. Kind regards, Suomaf You can use DOM Functions to do that. In my point of view, it's better you work with DOM rather SimpleXML. You need only create a consistent structure of the XML you're working (I suggest DTD or Schema validation).Take a look at the PHP manual for DOM Functions. -- []'s Diego www.dnfeitosa.com <http://www.dnfeitosa.com>