note 11780 deleted from function.xpath-eval by sobak
| From: | sobak@php.net | Date: | Tue, 22 Nov 2016 08:15:38 +0000 |
| Subject: | note 11780 deleted from function.xpath-eval by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207466@lists.php.net to get a copy of this message | ||
Note Submitter: pking at hoovers dot com
----
This is a very (very) minor point, but there is a comma missing in the function definition for
xpath_eval. This being my first experience with xpath, I thought "object xpath context"
was refering to a single parameter produced by a previous call to xpath_new_context(). Then I
couldn't see where you would add the query (which is actually the context parameter)
So the proper definition should be
array xpath_eval (object xpath, context)
Additionally an example would be nice. I found one from a post to phpbuilder.com:
-------------------------------
http://www.phpbuilder.com/annotate/message.php3?id=1002772
-------------------------------
Message # 1002772:
Date: 01/02/01 06:40
By: Luis Argerich
Subject: new DOM features im 4.0.4
Just wanted to add that PHP 4.0.4 has improved DOM support including Xpath and
Xpointer support:
Try this:
$xml='SOME XML ....';
$doc=xmldoc($xml);
$ctx=xpath_new_context($doc);
$foo=xpath_eval($ctx,"//title");
print_r($foo);
It returns an object that contains a property called Nodeset with an array of DomNodes with the
result of the Xpath expression. print_r($foo) to see the full structure.
4.0.4 has also added Xpointer support, so with Xpath and Xpointer support we can really do a lot of
things from PHP to XML files.
Luis.