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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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-2022 The PHP Group
All rights reserved.
Last updated: Sat Sep 24 23:05:52 2022 UTC