AW: appendChild() something I fail to understand
Brought to you by:
bs_php,
nigelswinson
From: J. C. <jan...@im...> - 2002-01-17 09:20:22
|
Instead of: > $xPath->appendChild('/connectes[1]', 'user'); You need to get the path to the new Child: $newchild=$xPath->appendChild('/connectes[1]', 'user'); Then you can work with it: $attributes['name'] = $user_name; $attributes['intime'] = time(); $xPath->setAttributes($newchild, $attributes); That should do it, I guess Jan > > $xPath->exportToFile('xml_files/connectes.xml','','<?xml > version="1.0" encoding="iso-8859-1"'.'?'.'>'); > $is_connected = 'oui'; > $session_register("is_connected"); > > At the firdst invocation every thing goes fine > > But if I open another browser (to simulate twoi user I use > netscape for one > and MIE for the other) the seond user is added to my connectd.xml > file but > the first one is emptied > > here is the file > > Step one : no one is connected > ======================== > <?xml version="1.0" encoding="iso-8859-1"?> > <connectes/> > > Step two first user connected > ======================== > <?xml version="1.0" encoding="iso-8859-1"?> > <connectes> > <user name="user1" intime="1011253765"/> > </connectes> > > Step three a second user is connected > =============================== > <?xml version="1.0" encoding="iso-8859-1"?> > <connectes> > <user name="user2" intime="1011253789"/> > <user/> > </connectes> > > As you can see the second user is added to the file.. but the > first is emptied. > > Where did I screw up ??? > > Any idea ? > > Luc > > > _______________________________________________ > Phpxpath-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpxpath-users > |