我正在尝试解析以下 HTML 文件,我想要获取键的值。这是在 Silverlight for Windows phone 上完成的。
</tr>
<tr><td width="26"><div style="width: 26px; height: 1px;"><spacer type="block" width="26" height="1" /></div></td><td width="60" id="tbtime">10:00</td><td width="70%" id="tbcol"><a href="/repertoir/filminfo.php?id=596">Ральф</a></td><td width="30%" id="tbcol" align="center">100 руб.</td></tr><tr><td width="26" height="4"><div style="width: 26px; height: 4px;"><spacer type="block" width="26" height="4" /></div></td><td width="60"></td><td width="100%" colspan="2"></td></tr><tr><td width="26"><div style="width: 26px; height: 1px;"><spacer type="block" width="26" height="1" /></div></td><td width="60" id="tbtime">12:00</td><td width="70%" id="tbcol"><a href="/repertoir/filminfo.php?id=595"> Сумерки. Сага. Рассвет: Часть 2</a></td><td width="30%" id="tbcol" align="center">100 - 120 руб.</td></tr><tr><td width="26" height="4"><div style="width: 26px; height: 4px;"><spacer type="block" width="26" height="4" /></div></td><td width="60"></td><td width="100%" colspan="2"></td></tr><tr><td width="26"><div style="width: 26px; height: 1px;"><spacer type="block" width="26" height="1" /></div></td><td width="60" id="tbtime">14:20</td><td width="70%" id="tbcol"><a href="/repertoir/filminfo.php?id=595"> Сумерки. Сага. Рассвет: Часть 2</a></td><td width="30%" id="tbcol" align="center">120 - 150 руб.</td></tr><tr><td width="26" height="4"><div style="width: 26px; height: 4px;"><spacer type="block" width="26" height="4" /></div></td><td width="60"></td><td width="100%" colspan="2"></td></tr><tr><td width="26"><div style="width: 26px; height: 1px;"><spacer type="block" width="26" height="1" /></div></td><td width="60" id="tbtime">16:40</td><td width="70%" id="tbcol"><a href="/repertoir/filminfo.php?id=607">Бункер</a></td><td width="30%" id="tbcol" align="center">150 руб.</td></tr><tr><td width="26" height="4"><div style="width: 26px; height: 4px;"><spacer type="block" width="26" height="4" /></div></td><td width="60"></td><td width="100%" colspan="2"></td></tr><tr><td width="26"><div style="width: 26px; height: 1px;"><spacer type="block" width="26" height="1" /></div></td><td width="60" id="tbtime">18:40</td><td width="70%" id="tbcol"><a href="/repertoir/filminfo.php?id=595"> Сумерки. Сага. Рассвет: Часть 2</a></td><td width="30%" id="tbcol" align="center">150 - 180 руб.</td></tr><tr><td width="26" height="4"><div style="width: 26px; height: 4px;"><spacer type="block" width="26" height="4" /></div></td><td width="60"></td><td width="100%" colspan="2"></td></tr><tr><td width="26"><div style="width: 26px; height: 1px;"><spacer type="block" width="26" height="1" /></div></td><td width="60" id="tbtime">21:00</td><td width="70%" id="tbcol"><a href="/repertoir/filminfo.php?id=595"> Сумерки. Сага. Рассвет: Часть 2</a></td><td width="30%" id="tbcol" align="center">150 - 180 руб.</td></tr><tr><td width="26" height="4"><div style="width: 26px; height: 4px;"><spacer type="block" width="26" height="4" /></div></td><td width="60"></td><td width="100%" colspan="2"></td></tr></table>
<br /><br />
<br /><br />
public void myparsing()
{
HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
WebClient webClient = new WebClient();
document.LoadHtml(webClient.DownloadString("http://udokan.chita.ru/"));
var node = document.DocumentNode.SelectSingleNode("//body/table/tr/td[4]/table");
if (node != null)
{
var innerText = node.InnerText;
richTextBox1.AppendText(innerText);
}
}
我想获得有关曲目的信息,但我不能。我有 HttpAgilityPack 的问题。方法 SelectNodes 不起作用。请帮助我,我很抱歉我的英语不好。