I am trying to parse a folder full of .htm files. All these files contain 1 specific element that needs to be removed.
It's a td
element with class="hide"
. So far, this is my code.
$dir. entry
is the full path to the file.
$page = ($dir . $entry);
$this->domDoc->loadHTMLFile($page);
// Use xpath query to find the menu and remove it
$nodeList = $xpath->query('//td[@class="hide"]');
Unfortunately, this is where things already go wrong. If I do a var_dump
of the node list, I get the following:
object(DOMNodeList)#5 (0) { }
Just so you folks get an idea of what I'm trying to select, here's an excerpt:
<td width="160" align="left" valign="top" class="hide">
lots of other TD's and content here
</td>
Does anybody see anything wrong with what I've come up with so far?