Very basic question
Brought to you by:
bs_php,
nigelswinson
From: Luc Saint-E. <lu...@sa...> - 2002-01-16 14:12:33
|
Hello, I've been using phpxml the xpath.class.php but only to read wml file. Now I need to use it to add stuff in a xml file and I fail The file is very basic: <connectes> <user name="fooname" intime="footime"/> <user name="fooname1" intime="footime2"/> etc... </connectes> Doing : require_once 'lib/XPath.class.php'; $xPath = new XPath(); $attributes = array(); $xPath->reset(); $xPath->importFromFile('xml_files/connectes.xml'); $xPath->appendChild('/connectes[1]', 'user'); $attributes['name'] = $user_name; // => $user_name is a session variable $attributes['intime'] = time(); $xPath->setAttributes('/connectes[1]/user[1]', $attributes); Nothing happen, I get no error but the xml file is left untouched Luc |