Re: how to edit a xml file

From: Date: Sat, 09 Sep 2006 05:19:56 +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-7238@lists.php.net to get a copy of this message
Hello all, Much apologies for the confusion, what i am doing is reading in a file todo.xml and populating my treeview with a list of todo tasks. when the user has done the task, he will click done [] toggle and i would like to be able to save this new infomation into the todo.xml file. At the moment I have a function working which is when the user adds a new task, I can add to the treeview and also add to the xml file , doing something like this.... $toDoList = simplexml_load_file('./data/todo.xml'); $index = 0; foreach ($toDoList->task as $task) { $intID = (int)$task->id; if ($index <= $intID) { $index = $intID +1; } } echo $index; $newTask = $toDoList->addChild('task'); $newTask->addChild('id',$index); $newTask->addChild('done', 0); $newTask->addChild('toDo', $toDo); $newTask->addChild('priority',$priority); $newTask->addChild('date',$dateString); file_put_contents('list2.xml',$toDoList->asXML()); This appends the NEW task to the end of the todo.xml, what i am trying to do is actually chage the todo.xml when user clicks done. Thank you very much, Suomaf -- View this message in context: http://www.nabble.com/how-to-edit-a-xml-file-tf2242296.html#a6220632 Sent from the Php - GTK - General forum at Nabble.com.

« previous php.gtk.general (#7238) next »