note 23246 added to function.xpath-eval

From: Date: Fri, 12 Jul 2002 15:53:58 +0000
Subject: note 23246 added to function.xpath-eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-32997@lists.php.net to get a copy of this message
From php > 4.0.7 this function has a optional third argument: a context node object. The signature reads: array xpath_eval ( object context, string xpath [, object context_node] ) It allows you to do relative searches like this: ---- XML ---- <doc> <section> <title>My title!</title> </section> </doc> ---- CODE ---- $xml = '....'; $dom = domxml_open_mem($xml); $ctx = xpath_new_context($dom); $nodes = xpath_eval($ctx, '//section'); # we have a list with all section element objects $node = $nodes->nodeset[0]; $nodes = xpath_eval($ctx, 'title'); # we have a list of all title element objects that are a child of the first section element -- ralphm -- http://www.php.net/manual/en/function.xpath-eval.php http://master.php.net/manage/user-notes.php?action=edit+23246 http://master.php.net/manage/user-notes.php?action=delete+23246 http://master.php.net/manage/user-notes.php?action=reject+23246

« previous php.notes (#32997) next »