使用Xml文档阅读网页文本内容

时间:2016-10-05 11:38:48

标签: c# xml webpage

我正在尝试使用Xml Document阅读网页文本:

XmlDocument document = new XmlDocument();
string site = "https://emailhunter.co/search/a-bs.com";
document.Load(site);
string allText = document.InnerText;

这是我得到的例外:

  

System.Xml.dll中发生了未处理的“System.Xml.XmlException”类型异常   附加信息:';'字符,十六进制值0x3B,不能包含在名称中。第5行,第383位。

我真的不明白这里有什么不对。如果你能给我一些提示,我会非常感激。

1 个答案:

答案 0 :(得分:0)

您可以使用此帖中所写的 Html Agility Pack What is the best way to parse html in C#?