我想使用HTMLAgilityPack
. 我有一些代码:
HtmlAgilityPack.HtmlWeb TheWebLoader = new HtmlWeb();
HtmlAgilityPack.HtmlDocument TheDocument = TheWebLoader.Load(textBox1.Text);
List<string> TagsToRemove = new List<string>() { "script", "style", "link", "br", "hr" };
var Strings = (from n in TheDocument.DocumentNode.DescendantsAndSelf()
where !TagsToRemove.Contains(n.Name.ToLower())
select n.InnerText).ToList();
textBox2.Lines = Strings.ToArray();
问题是,它也返回了script
标签的内容。我不知道为什么会这样。有谁能够帮我?