Hi all,
I am in the following situation. I am trying to convert a messy scraped html code to a nice and neat xml structure.
A partial HTML code of the scraped website:
<p><span class='one'>week number</span></p>
<p><span class='two'>day of the week</span></p>
<table class='spreadsheet'>
table data
</table>
<p><span class='two'>another day of the week</span></p>
<table class='spreadsheet'>
table data
</table>
<p><span class='one'>another week number</span></p>
ETC
Now I want to create the following xml structure with php:
<week number='week number'>
<day name='day of the week'>
<data id='table data'>table data</data>
</day>
<day name='another day of the week'>
<data id='table data'>table data</data>
</day>
</week>
<week number='another week number'>
ETC
</week>
Have been trying the simple html dom method, but have no idea how to get the next sibling and check wether it is a new day of the week, a new table data or a new week etc..
I am, of course, also open to other solutions.
Thanks.
Cheers, Dandoen