[phpXML] [phpXML] I did some modifications...
Brought to you by:
bs_php,
nigelswinson
From: <flo...@co...> - 2001-10-08 14:13:17
|
I did some modifications to the phpxml librarie v1.0, as I have discovered a minor bug and missing some feature I needed. For more details see http://www.kzar.net/testxml.php First, now you can do a XPath expression like this one: //document/keyword[contains(text(),'some text')]/parents::* Formerly, this expression did an error as the lib guess that it was a XPtah function like "contains(text()" because of fails inclusive parenthesis detection (sorry for my poor english...) I also added a new method: count_nodes($path) that returns numbers of elements within the path. e.g. you can do: $nodes =3D $xml->count_nodes("/document[$j]/keyword"); for($i=3D1; $i<=3Dnodes; $i++) echo "Keyword =3D ".$xml->get_content("/document[1]/keyword[$i]")."<br>"; This way you don't evaluate a path like that : $test =3D $xml->evaluate("//document[$j]/keyword); foreach($test as $node) echo "Keyword =3D ".$xml->get_content($test)."<br>"; This is usefull and time execution saving as you don't have to evaluate again a path. Any comments and suggestions are welcome. I have a question: is phplib found on the www.phpxml.org site is uptodate? Thank's! Florent Gilles -- This message has been sent through the <phpXML/> user discussion list. To u= nsubscribe, please visit https://sslsites.de/mailinglisten/user/user@lists.= phpxml.org/ |