ID: 16647
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Analyzed
Bug Type: DOM XML related
Operating System: linux 2.4.4
-PHP Version: 4.0CVS-2002-04-16
+PHP Version: 4.0CVS-2002-04-1
New Comment:
get_element_by_id() used xpath_eval as well but
searches for "//*[@ID = '%s']". If you capitalize
the id it should work. Do you have an idea how to search
case insensitve?
Previous Comments:
------------------------------------------------------------------------
[2002-04-16 20:04:48] [EMAIL PROTECTED]
The following script returns bool(false):
<?php
$src = <<< _END
<html>
<head><title> Test </title></head>
<body>
<h1>Test</h1>
<span id="test">Foo</span>
</body>
</html>
_END;
$doc = domxml_open_mem($src);
$n = $doc->get_element_by_id("test");
var_dump($n);
?>
Workaround: Use Xpath expressions to find the node:
<?php
$src = <<< _END
<html>
<head><title> Test </title></head>
<body>
<h1>Test</h1>
<span id="test">Foo</span>
</body>
</html>
_END;
$doc = domxml_open_mem($src);
$ctx = $doc->xpath_new_context();
$res = $ctx->xpath_eval("//*[@id='test']");
$n = $res->nodeset[0];
var_dump($n);
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16647&edit=1