note 118611 deleted from domdocument.getelementbyid by salathe

From: Date: Fri, 08 Jan 2016 09:14:50 +0000
Subject: note 118611 deleted from domdocument.getelementbyid by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-204616@lists.php.net to get a copy of this message
Note Submitter: Marek Mhling ---- @paradox_haze had problems, too, when dealing with XHTML, my solution without XPath: function getElementById($doc, $tag, $id){ //needed with loadXML() //not with Load() or loadHTMLFile() foreach($doc->getElementsByTagName($tag) as $el){ if($el->getAttribute('id') == $id){ return $el; } } } $doc = new DOMDocument(); $doc->loadXML($myUri); $myObj = getElementById($doc, 'myTagName', 'myIdStrg');

« previous php.notes (#204616) next »