我正在使用以下方法从字符串中删除所有HTML:
public static string StripHtmlTags(string html)
{
if (String.IsNullOrEmpty(html)) return "";
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
return doc.DocumentNode.InnerText;
}
但似乎忽略了以下标记:[…]
因此,该字符串基本上返回:
> A hungry thief who stole a rack of pork ribs from a grocery store has
> been sentenced to spend 50 years in prison. Willie Smith Ward felt the
> full force of the law after being convicted of the crime in Waco,
> Texas, on Wednesday. The 43-year-old may feel slightly aggrieved over
> the severity of the […]
我该如何确保这种标记被剥离?
非常感谢任何帮助。
…
不是HTML标签。标签要有尖括号(angle brackets)。这是一个编码实体。 - jessehouwing