Ok im trying to build an xml feed from this HTML table using PHP Simple HTML DOM Parser.
<table>
<tr><td colspan="5"><strong>Saturday October 15 2011</strong></td></tr>
<tr><td>Team 1</td> <td>vs</td> <td>Team 7</td> <td>3:00 pm</td></tr>
<tr><td>Team 2</td> <td>vs</td> <td>Team 12</td> <td>3:00 pm</td></tr>
<tr><td>Team 3</td> <td>vs</td> <td>Team 8</td> <td>3:00 pm</td></tr>
<tr><td>Team 4</td> <td>vs</td> <td>Team 10</td> <td>3:00 pm</td></tr>
<tr><td>Team 5</td> <td>vs</td> <td>Team 11</td> <td>3:00 pm</td></tr>
<tr><td colspan="5"><strong>Monday October 17 2011</strong></td></tr>
<tr><td>Team 6</td> <td>vs</td> <td>Team 9</td> <td>7:45 pm</td></tr>
<tr><td colspan="5"><strong>Saturday October 22 2011</strong></td></tr>
<tr><td>Team 7</td> <td>vs</td> <td>Team 12</td> <td>3:00 pm</td></tr>
<tr><td>Team 1</td> <td>vs</td> <td>Team 2</td> <td>3:00 pm</td></tr>
<tr><td>Team 8</td> <td>vs</td> <td>Team 4</td> <td>3:00 pm</td></tr>
<tr><td>Team 3</td> <td>vs</td> <td>Team 6</td> <td>3:00 pm</td></tr>
<tr><td>Team 9</td> <td>vs</td> <td>Team 5</td> <td>3:00 pm</td></td></tr>
<tr><td>Team 10</td> <td>vs</td> <td>Team 11</td> <td>3:00 pm</td></tr>
</table>
What I am aiming to do is extract the Date and then the following rows up until the next date. so that I can build an XML node as such for each of the dates.
<matchday date="Saturday October 15 2011">
<fixture>
<hometeam>Team 1</hometeam>
<awayteam>Team 7</awayteam>
<kickoff>3:00 pm</kickoff>
</fixture>
<fixture>
<hometeam>Team 2</hometeam>
<awayteam>Team 12</awayteam>
<kickoff>3:00 pm</kickoff>
</fixture>
</matchday>
I have at present each of the dates from the html and built their respective xml nodes
$dateNodes = $html->find('table tr td[colspan="5"] strong');
foreach($dateNodes as $date){
echo '<matchday day="'.trim($date->innertext).'">';
// FIXTURES
// END FIXTURES
echo '</matchday>';
}
How would i go about getting the team names etc for each fixture up until the next matchday date?