Lets assume I get an HTML table as a string, and I want - using C# - to dissect it to its elements (td, div - if any, etc.) and obtain each of their attributes, such as 'style', 'class'...
My goal is to eventually get an HTML table and build a table object of my own out of it, retaining most (if not all) of the table's attributes. Now, the only way I can think of doing this, seems to me like a coding-nightmare: dissect the string to each of its 'tr' and 'td' and start digging in, looking for each of those element's attribute and try to parse it to something I can work with - is there any other way?
Example:
string someString = "<div><table cellpadding="0" cellspacing="0"><tr><td style="border-bottom:1px solid transparent;width:1px;font-size:1px;height:1px;line-height:1px;"><div class="someClass">..."
will become (in my hypothetical object):
MyTable table = new MyTable
{
CellPadding = "0",
...
}
MyTableRow row = new MyTableRow
{
Cell[0].Style.BorderBottom = "1px solid transparent",
Cell[0].Style.Width = "1px",
...
}
you get the idea :)