getElementById question (bug report)
[email protected] (Bernhard Zwischenbrugger) Wed, 26 May 2004 09:52:27 +0200
| Newsgroups | php.xml.dev |
|---|---|
| Organization | Datenküche |
| Message-ID | <[email protected]> |
Hi
I have a problem with "getElementById":
Working example:
============
-----------snip---
<?php
$xmlstring = '<?xml version="1.0" ?>
<!DOCTYPE books [
<!ATTLIST book id ID #IMPLIED>
]>
<books>
<book id="1">
<title>Book 1</title>
</book>
<book id="2">
<title>Book 2</title>
</book>
</books>';
$dom = new DomDocument();
$dom->loadXML($xmlstring);
$node = $dom->getElementById("1");
print $node->nodeValue;
?>
----snap--------
NOT working example:
===============
---snip---
<?php
$xmlstring = '<?xml version="1.0" ?>
<books>
<book id="1">
<title>Book 1</title>
</book>
<book id="2">
<title>Book 2</title>
</book>
</books>';
$dom = new DomDocument();
$dom->loadXML($xmlstring);
$node = $dom->getElementById("1");
print $node->nodeValue;
?>
----snap-----
===========
If there is no DTD the method "getElementById" is not working.
I don't know the DOM Standard very good, but I think this is an PHP error.
Env:
PHP5 RC2, Linux
Bernhard