Hi, I have written code to fetch all the FONT elements from the html below using DOMDocument and copy them into an array and remove all the empty elements. Everything works fine except that I don't know how to remove the empty elements from the array. Here is what I have:
<TABLE><TR><TD width="6%"> </TD>
<TD><PRE ><FONT >
<TR>
<TD>
<FONT COLOR=000000>DT</FONT>
<FONT COLOR=000000>01</FONT>
<FONT COLOR=000000> </FONT>
<FONT COLOR=0000FF>03</FONT>
<FONT COLOR=0000FF> </FONT>
<FONT COLOR=000000>LL</FONT>
</FONT></PRE></TD>
</TR>
</TABLE>
$mastersched = file_get_contents('m2.html');
$dom = new DomDocument();
$dom->preserveWhiteSpace = false;
$dom->loadHTML($mastersched);
$x = new DomXPath($dom);
$nodes = $x->query('/html/body/table/tr/td[2]/pre/font/font');
$nodelength = $nodes->length;
foreach ($nodes as $node) {
$nodearr[] = $node; //copy node object to array
}