php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42141 DOM getNamedItem() case-issue
Submitted: 2007-07-29 16:08 UTC Modified: 2007-07-29 21:10 UTC
From: linus dot martensson at elplan-gm dot se Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.2.3 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-07-29 16:08 UTC] linus dot martensson at elplan-gm dot se
Description:
------------
DOMNamedNodeMap->getNamedItem() is case-sensitive, the ability to change this would be useful in templating systems. Add a second parameter for case-sensitive?

Reproduce code:
---------------
$xml = new DOMDocument();
$xml->loadXML('<html><head><!--yadayada--></head><body><div Id="testid"></div></body></html>');
$element = $xml->getElementById('testid');
echo $element->attributes->getNamedItem('id');

Expected result:
----------------
should echo "testid", the name of the element retrieved.

Actual result:
--------------
Echoes nothing, as the 'Id' in the xml is spelt with a capital I.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-29 16:15 UTC] derick@php.net
XML is case-sensitive... you'll just have to deal with this in your scripts.
 [2007-07-29 21:10 UTC] linus dot martensson at elplan-gm dot se
I see... Oh well, a suggestion is a suggestion, I just thought it'd match up better with all the other PHP functions that support both modes. 
Thanks anyways. =]
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 03:01:29 2024 UTC