I'm using PHP DOM and DOMXPath class. This is what I have in essence:
<table>
<tr>
<td><div> More data </div></td>
</tr>
<tr>
<td><div> More data </div></td>
</tr>
<tr>
<td><div> More data </div></td>
</tr>
<tr>
<td><div> More data </div></td>
</tr>
// I want all of these removed
<tr>
<td class="className"></td> // Nothing between <td> tags here
</tr>
// Repeat N times
.
.
.
.
</table>
This is a pattern of rows and repeats plenty of times.
What I want is an XPath expression which will get me all the rows but discard every row like the last one in this example.
To be clear: not the last row only but discard every row which meets some criteria and return others.
You can use normalize-space()
to filter out empty nodes, for example :
/table/tr[normalize-space(.)]