Re: Very basic question
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-01-16 14:19:36
|
> 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 |