twittoris Posted September 16, 2010 Share Posted September 16, 2010 i found some code that is helping me extract a table. Currently it works and extracts every single table row however it duplicates some of the rows. I am new to XPATH and would appreciate if someone could comment the following code so that I can alter it to meet my needs. Thanks. $newDom->appendChild($newDom->importNode($item,true)); $xpath = new DOMXPath( $newDom ); foreach ($item->attributes as $attribute) { for ($node = $item->firstChild; $node !== NULL; $node = $node->nextSibling) { if (($attribute->nodeName =='valign') && ($attribute->nodeValue=='top')) { print($node->nodeValue); } else { print("<br>".$node->nodeValue); } } print("<br>"); Link to comment https://forums.phpfreaks.com/topic/213589-can-someone-explain-this-code-for-me/ Share on other sites More sharing options...
twittoris Posted September 16, 2010 Author Share Posted September 16, 2010 Also, Is it possible to store each table row in an array? Link to comment https://forums.phpfreaks.com/topic/213589-can-someone-explain-this-code-for-me/#findComment-1111743 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.