|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28689 Without registerNamespace() method, XPath function is crippled
Submitted: 2004-06-08 03:06 UTC Modified: 2004-06-08 03:40 UTC
From: Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.0.0RC2 OS: Irrelevant
Private report: No CVE-ID: None
 [2004-06-08 03:06 UTC]
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-08 03:40 UTC]
See #27709.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 15:01:28 2024 UTC