php.net |  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: davey@php.net 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] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-08 03:40 UTC] amt@php.net
See #27709.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC