A little bit confused
Brought to you by:
bs_php,
nigelswinson
From: Luc Saint-E. <lu...@sa...> - 2002-01-17 16:13:40
|
Hello (again..)) I've been away from xpath.class.php for some time and I'm trying without=20 succes very simple things with the last dev version I use /Xpath-develop/XPath.class.php (from the cvs) here is my xml file : ----------------------------------------------------------------------------= ---- <?xml version=3D"1.0" encoding=3D"iso-8859-1"?> <liste> <message> <is_read>no</is_read> <texte>qfdmqkjsdmlfkqkdf</texte> <expediteur>userone</expediteur> <destinataire>usertwo</destinataire> <date>1011277311</date> </message> <message> <is_read>no</is_read> <texte>bon salut ma poule</texte> <expediteur>usertwo</expediteur> <destinataire>userone</destinataire> <date>1011278602</date> </message> <message> <is_read>no</is_read> <texte>kgluylutglk=E8utky(kdyrkglu-iuykuyd(u=E8</texte> <expediteur>userone</expediteur> <destinataire>usertwo</destinataire> <date>1011279657</date> </message> </liste> ----------------------------------------------------------------------------= -------- here is a dam simple bit of code : ----------------------------------------------------------------------------= ----------- require_once 'lib/XPath.class.php'; $xPath =3D new XPath(); $xPath->importFromFile('xml_files/messages.xml'); $msglist =3D $xPath->evaluate('/liste/message'); print_r($msglist); echo '<br>'; foreach ( $msglist as $msg ) { echo $msg.'<br>'; $is_read =3D $xPath->getData($msg.'/is_read[1]'); echo $is_read.'<br>'; $texte =3D $xPath->getData($msg.'/texte[1]'); echo $texte.'<br>'; $expediteur =3D $xPath->getData($msg.'/expediteur[1]'); echo $expediteur.'<br>'; } echo $xPath->exportAsHtml(); ----------------------------------------------------------------------------= ------------- Dump of the evaluate() is ok : $msglist Array ( [0] =3D> /liste[1]/message[1] [1] =3D> /liste[1]/message[2] [2] =3D> /liste[1]/message[3] ) Dump of exportAsHtml() is OK But all getData() variables are empty... Any direction ? Luc |