#28689 [Opn->Bgs]: Without registerNamespace() method, XPath function is crippled

From: Date: Tue, 08 Jun 2004 01:40:10 +0000
Subject: #28689 [Opn->Bgs]: Without registerNamespace() method, XPath function is crippled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-60533@lists.php.net to get a copy of this message
ID: 28689 Updated by: amt@php.net Reported By: davey@php.net -Status: Open +Status: Bogus Bug Type: SimpleXML related Operating System: Irrelevant PHP Version: 5.0.0RC2 New Comment: See #27709. Previous Comments: ------------------------------------------------------------------------ [2004-06-08 03:06:16] davey@php.net Description: ------------ Because XPath cannot select nodes from the default namespace (i.e. xmlns="foo") an alias must be added. This is possible in the DOM extension using the DomXpath::registerNamespace() method. Because SimpleXML does not have this, its XPath implementation is quite crippled. The only way around this is the following: $sxml = simplexml_load_*($xml) $sxml['xmlns:foo'] = 'http://foo'; $sxml = simplexml_load_string($sxml->asXML()); Which is quite stupid really. - Davey ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28689&edit=1

« previous php.bugs (#60533) next »