note 20057 added to function.xptr-eval
| From: | sbarnum at pointsystems dot chek dot com | Date: | Wed, 20 Mar 2002 23:18:16 +0000 |
| Subject: | note 20057 added to function.xptr-eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28011@lists.php.net to get a copy of this message | ||
Found a must-see tutorial for generating xPath expressions:
http://www.zvon.org/xxl/XPathTutorial/General/examples.html
For newbies (like me) out there, here's how you use xpath on an xml file:
$expression = "//SomeElement/Child";
$doc = xmldocfile('myfile.xml');
$xpc = xpath_new_context($doc);
$result = xpath_eval($xpc, $expression);
$found = $result->nodeset;
echo "<pre>";
echo "xpath found " . count($found) . "match(es):\n";
foreach($found AS $node)
xmlnode2html($node);
echo "</pre>";
----------------------------------
the $result is an object containing an array of nodes matching the xpath expression.
--
http://www.php.net/manual/en/function.xptr-eval.php
http://master.php.net/manage/user-notes.php?action=edit+20057
http://master.php.net/manage/user-notes.php?action=delete+20057
http://master.php.net/manage/user-notes.php?action=reject+20057