Re: getElementById question (bug report)

From: Date: Wed, 26 May 2004 07:53:11 +0000
Subject: Re: getElementById question (bug report)
References: 1  Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-376@lists.php.net to get a copy of this message
On 26.5.2004 9:52 Uhr, Bernhard Zwischenbrugger wrote:
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.
No, this is the correct behaviour. chregu
Env: PHP5 RC2, Linux Bernhard
-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECB

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