note 55916 rejected from function.domnode-last-child by mazzanet

From: Date: Wed, 17 Aug 2005 20:45:12 +0000
Subject: note 55916 rejected from function.domnode-last-child by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93809@lists.php.net to get a copy of this message
Note Submitter: mercury_usa at hotmail dot com ---- How in the world do you use this function? This is what I have... $xml_file = "Forum.xml"; //on my PC I have it the the absolute path. if(!$doc = xmldocfile($xml_file)) { die("Error al abrir archivo XML."); } $root = $doc->root(); $children = $root->children(); for ($x=0; $x<sizeof($children); $x++) { $attrib = $children[$x]->attributes(); if ($children[$x]->has_child_nodes()) { echo "<tr>\n"; echo "<td>".$attrib[1]->value."</td>\n"; echo "<td>".$attrib[0]->value."</td>\n"; $cc = $children[$x]->children(); $ca = $cc[1]->attributes(); echo "<td>".$ca[0]->value."</td>\n"; } if ($children[$x]->has_child_nodes()) { echo "</tr>\n"; } } This is the XML file <?xml version="1.0" encoding="ISO-8859-1" ?> <Forum> <Thread id="20" subject="Testing" > <Article author="Name1" date="2005-08-04" > Text1 </Article> </Thread> <Thread id="24" subject="Probando múltiples artículos"> <Article author="Name2" date="2005-08-07" > Text2 </Article> <Article author="Name3" date="2005-08-08" > Text3 </Article> <Article author="Name4" date="2005-08-09" > Text1 </Article> </Thread> <Thread id="25" subject="Carne descongelada" > <Article author="Name5" date="2005-08-10" > Text4 </Article> <Article author="Name6" date="2005-08-11" > Text5 </Article> </Thread> </Forum> I need to output a table with the Subjects the ID and the Author of the LAST article (asuming the last article is the last child... I can't do it with last child... I have been trying for HOURS and I will keep trying... any ideas? if I figure it out I will post again.

« previous php.notes (#93809) next »