note 45862 added to function.dom-domxpath-registernamespace

From: Date: Tue, 21 Sep 2004 22:33:31 +0000
Subject: note 45862 added to function.dom-domxpath-registernamespace
Groups: php.notes 
Request: Send a blank email to php-notes+get-77130@lists.php.net to get a copy of this message
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" ---- Manual Page -- http://www.php.net/manual/en/function.dom-domxpath-registernamespace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45862 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45862&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45862&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77130) next »