可以到 http://www.oschina.net 开源中国社区下载相关Dll,百度有很多如何使用的资料
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.Load("city.html");
HtmlNodeCollection cityAll = doc.DocumentNode.SelectNodes("//div[starts-with(@class,'tablebox')]//table/tr/td/a[@href]");
string text = "";
string wrong = "";
foreach (HtmlNode link in cityAll)
{
if (link.Attributes["onclick"] == null)
continue;
text += link.Attributes["onclick"].Value;
}
FileStream fs1 = new FileStream("E:\\HtmlTxt.txt", FileMode.Create, FileAccess.Write);//创建写入文件
StreamWriter sw = new StreamWriter(text );
sw.WriteLine(all);//开始写入值
sw.Close();
fs1.Close();
doc.DocumentNode.SelectNodes("……")其中的参数可以去网上搜,有很多介绍如何使用的,可以对Class进行选择,属性进行选择,路径进行选择。