这里有个 非常好的分析 HTML的 类。
节约了不少时间。
项目地址
http://www.codeplex.com/Wiki/View.ASPx?ProjectName=HTMLagilitypack
For example, here is how you would fix all hrefs in an HTML file:
HTMLDocument doc = new HTMLDocument();
doc.Load("file.htm");
foreach(HTMLNode link in doc.DocumentElement.SelectNodes("//a@href")
{
HTMLAttribute att = link"href";
att.Value = FixLink(att);
}
doc.Save("file.htm");
If you want to participate to the project - because that's the whole purpose of putting the source there, right - use the forums or drop me a note (simon underscore mourier at hotmail dot com)!
Happy coding, scraping, scanning, HTML-ing, xHTML-ing, etc... :^)
Simon Mourier.
http://www.cnblogs.com/wujun/archive/2006/10/31/545646.HTML
。