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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: davey@php.net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sat Dec 21 18:01:29 2024 UTC