本文介绍了如何提取从HTML文件在C#中的HTML链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能帮我解释如何提取的网址/ C#中的HTML文件链接
Can anyone help me by explaining how to extract urls/links from HTML File in C#
推荐答案
HtmlDocument doc = new HtmlDocument();
doc.Load("file.htm");
foreach(HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
{
HtmlAttribute att = link.Attributes["href"];
yourList.Add(att.Value)
}
doc.Save("file.htm");
这篇关于如何提取从HTML文件在C#中的HTML链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!