我相信这个问题以前已经问过了,我以前也看过,但我找不到答案,或者我只是做错了什么。
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(indivdualfix[0]);
HtmlWeb hwObject = new HtmlWeb();
HtmlAgilityPack.HtmlDocument htmldocObject = hwObject.Load(indivdualfix[0]);
HtmlNode body = htmldocObject.DocumentNode.SelectSingleNode("//body");
body.Attributes.Remove("style");
foreach (var a in body.Attributes.ToArray())
a.Remove();
string bodywork = body.InnerHtml.ToString();字符串体仍然返回所有的html编码。我可能遗漏了一些非常小的东西。需要做什么,以消除所有的html编码基本上。
发布于 2011-01-19 02:19:36
使用body.InnerText而不是body.InnerHtml
https://stackoverflow.com/questions/4727547
复制相似问题