I have an html table
<table border='0' width='100%'> <tr class='headerbg'> <th width='5%'> No </th> <th width='30%'> Name </th> <th width='20%'> Department or Division </th> <th width='25%'> Email </th> <th width='20%'> Staff/Student </th> </tr> <tr class='bg2'> <td> 1 </td> <td> <strong><a class='searchLink2' href='tel_search.php?fore=Dave&sur=Rumber'>Dave Rumber</a></strong> </td> <td> Medical School </td> <td> <a class='searchLink2' href='mailto:Dave.Rumber@Home.com'>Dave.Rumber@Home.com</a> </td> <td> Student </td> </tr> </table>
Sometimes there will be more than one row of people results. I would like to be able to go through each row and pluck out the name and e-mail information and do some other processing. Put the data in a datagrid, and possibly into a database.
I guess my question is how do I do this?
string table = GetContents(buffer); table = table.Replace(' ', ''); table = table.Replace('&', '&'); XElement inters = XElement.Parse(table);
I can put it into an XElement but I am not quite sure where to go from here!
Thanks!
Here’s some freehand code that should get you started. Don’t do this in production, this is an educational demonstration only.