note 21413 deleted from function.xpath-eval by didou
| From: | didou@php.net | Date: | Fri, 03 Oct 2003 16:42:21 +0000 |
| Subject: | note 21413 deleted from function.xpath-eval by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57763@lists.php.net to get a copy of this message | ||
Note Submitter: a.n@cerca.com
----
declarations of namespaces are implemented but not documented (v. 4.2.0)
function: xpath_register_ns(xpathctx_handle, namespace_prefix, namespace_uri)
return: true on success, false otherwise
--- XML---
<?xml version="1.0" standalone="yes"?>
<book xmlns:foo="http://www.foo.com/foo">
<author foo:ref="something">
<firstName>Dante</firstName>
<lastName>Alighieri</lastName>
<foo:item>Other</foo:item>
</author>
....
</book>
---- CODE ---
$xml='....';
$doc=xmldoc($xml);
$xpath_ctx=xpath_new_context($doc);
xpath_register_ns($xpath_ctx, 'foo', 'http://foo.com/foo');
//some examples (untested)
$xpath_nodes = xpath_eval($xpath_ctx, "//@foo:ref");
$xpath_nodes = xpath_eval($xpath_ctx, "//author/foo:item");
$xpath_nodes = xpath_eval($xpath_ctx, "/book/author/@foo:ref");
...