blogjava's web log ...
上次我寫的?【小技巧】如何得到一個網(wǎng)頁的所有a標(biāo)記 herf 鏈接代碼這樣很是麻煩。這里有個 非常好的分析 html的 類。節(jié)約了不少時間。項目地址http://www.codeplex.com/Wiki/View.aspx?ProjectName=htmlagilitypackFor 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("http://a){HtmlAttribute att = link;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.
posted on 2006-10-31 15:44 record java and net 閱讀(352) 評論(0) 編輯 收藏 所屬分類: dot net相關(guān)