在WPile的HTML Agility Pack中解析表

时间:2012-02-20 02:42:46

标签: windows-phone-7 html-parsing

我有以下HTML:

<table cellspacing="8" cellpadding="6" border="1" style="color: Black; background-color: LightGoldenrodYellow;
    width: 60%;" id="GridView2" rules="all">
    <tbody>
        <tr style="color: White; background-color: #CF4B0A; font-weight: bold;">
            <th align="center" scope="col">
                Booked At
            </th>
            <th align="center" scope="col">
                Booked On
            </th>
            <th align="center" scope="col">
                Delivered At
            </th>
            <th align="center" scope="col">
                Delivered On
            </th>
            <th scope="col">
                Details
            </th>
        </tr>
        <tr align="left" style="color: #333333; background-color: #FFFBA1; font-family: Arial;
            font-size: Small;">
            <td align="center">
                Not Available
            </td>
            <td align="center">
                Not Available
            </td>
            <td align="center">
                DATA
            </td>
            <td align="center">
                12/01/2012
            </td>
            <td>
                <a href="javascript:__doPostBack('GridView2$ctl02$LinkButton1','')" id="GridView2_ctl02_LinkButton1">
                    Details</a>
            </td>
        </tr>
    </tbody>
</table>

我想使用HTML Agility pack解析上表。我正在使用从Codeplex下载的WP7的HAP解决方案。 任何快速帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

要解析HTML,请使用HAP的HtmlDocument.LoadHtml()函数并将其传递给实际的字符串。这将为您提供一个包含所有HTML对象的DOM。