note 101598 deleted from domdocument.getelementbyid by danbrown
| From: | danbrown@php.net | Date: | Wed, 29 Dec 2010 18:44:39 +0000 |
| Subject: | note 101598 deleted from domdocument.getelementbyid by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175305@lists.php.net to get a copy of this message | ||
Note Submitter: Sina Falahati
----
regarding dom getelementid for simple xml documents:
See: http://php5.bitflux.org/phpconf2004/slide_72.php
(Note the ATTLIST)
<?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;