getElementById question (bug report)

From: Date: Wed, 26 May 2004 07:52:27 +0000
Subject: getElementById question (bug report)
Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-375@lists.php.net to get a copy of this message
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

« previous php.xml.dev (#375) next »