note 84641 added to domdocument.registernodeclass

From: Date: Wed, 23 Jul 2008 13:03:16 +0000
Subject: note 84641 added to domdocument.registernodeclass
Groups: php.notes 
Request: Send a blank email to php-notes+get-142600@lists.php.net to get a copy of this message
nobody at dontlikespam dot com- Take it easy. When there is a bug you should not cry because there is always a way out of any problem ;) childNodes is really not a usefull thing. If you want to get child nodes of some node you'd better use something like this: // check $doc = new DomDocument(); // load XML file $doc->loadXML($items); // Now loop through and get root // get those we need (all of them actually) $Elements = $doc->getElementsByTagName("item"); // loop through foreach($Elements as $elem) { // check if the element is a root one if($elem->parentNode->getAttribute("link")) {} else { // if it IS then check if it has child nodes if($elem->hasChildNodes()) { // if it has them just got only child nodes $Children = $elem->getElementsByTagName("item"); // do whatever you want with your children } } } ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/domdocument.registernodeclass.php Edit -- https://master.php.net/note/edit/84641 Del: integrated -- https://master.php.net/note/delete/84641/integrated Del: useless -- https://master.php.net/note/delete/84641/useless Del: bad code -- https://master.php.net/note/delete/84641/bad+code Del: spam -- https://master.php.net/note/delete/84641/spam Del: non-english -- https://master.php.net/note/delete/84641/non-english Del: in docs -- https://master.php.net/note/delete/84641/in+docs Del: other reasons-- https://master.php.net/note/delete/84641 Reject -- https://master.php.net/note/reject/84641 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142600) next »