#26813 [Bgs]: getElementById doesn't return anything
| From: | msw at seebi dot de | Date: | Wed, 07 Jan 2004 08:09:02 +0000 |
| Subject: | #26813 [Bgs]: getElementById doesn't return anything | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52920@lists.php.net to get a copy of this message | ||
ID: 26813
User updated by: msw at seebi dot de
Reported By: msw at seebi dot de
Status: Bogus
Bug Type: DOM XML related
Operating System: windows xp prof
PHP Version: 5.0.0b3 (beta3)
New Comment:
Thats not the correct behaviour according to W3C. I know this behaviour
because it is also used in PHP 4.x. You should fix this to get more
compatability with DOM. getElementById() should work without DTD.
Previous Comments:
------------------------------------------------------------------------
[2004-01-06 12:51:43] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
DTD required to use id
------------------------------------------------------------------------
[2004-01-06 08:32:36] msw at seebi dot de
Description:
------------
I'v used getElementById() to touch an element. It seems to me that
getElementById() doesn't return anything.
Reproduce code:
---------------
<?php
$dom = new domdocument;
$t=$dom->load(dirname(__FILE__)."/news.xml");
if(!$dom) {
echo "Error while parsing the document\n";
exit;
}
$node=$dom->getElementById("486");
print ($node);
print("<br>".$node->nodeName);
?>
XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<newsliste>
<news id="486" rubrik='xsl-fo' site="javaxml">
<datum>14.08.2003</datum>
<headline>Kleines Update von XEP</headline>
<text>blablablabla</text>
<Links>
<Web-Adresse xml:link='simple' href='http://xep.xattic.com/'>
<text>XEP 3.5.4</text>
</Web-Adresse>
</Links>
</news>
</newsliste>
Expected result:
----------------
The PHP code should print out the node name (news)
Actual result:
--------------
nothing
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26813&edit=1