note 45862 deleted from function.dom-domxpath-registernamespace by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 22 Sep 2004 19:33:33 +0000 |
| Subject: | note 45862 deleted from function.dom-domxpath-registernamespace by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77205@lists.php.net to get a copy of this message | ||
Note Submitter: gem at rellim dot com
----
I found the solution to my problem in the notes for xpath_eval()
Here is the abbreviated and updated example from there.
If you have a default namespace declaration such as the following document:
<?xml version="1.0" encoding="UTF-8"?>
<rootname xmlns="http://www.some.org"
xml:lang="en-US">
<childnode>Some text</childnode>
</rootname>
And you want to evaluate the xpath expression:
"/rootname/childnode"
It will not work in PHP 5.01
You need to register the default namespace in PHP like this:
$objectXPath->registerNamespace( "pre", "http://www.some.org");
and then use the following xpath expression:
"/pre:rootname/pre:childnode"