Re: Very basic question
Brought to you by:
bs_php,
nigelswinson
From: Luc Saint-E. <lu...@sa...> - 2002-01-16 15:23:29
|
Nigel, In fact I had to ad : $xPath->setAttribute('/am/i/stupid[1]', 'yes'); Luc At 14:18 16/01/02 +0000, Nigel Swinson wrote: > > 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 > >Are you doing a ->exportToFile($filename)? If you don't export, then >changes will not persist to disk. > >Nigel > > > >_______________________________________________ >Phpxpath-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phpxpath-users |