第三方SgmlReaderDll
/// <summary>
/// 把html转成XML
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
private static XElement Html2XML(string html)
{
Sgml.SgmlReader sgmlReader = new Sgml.SgmlReader();
sgmlReader.DocType = "HTML";
sgmlReader.WhitespaceHandling = WhitespaceHandling.All;
sgmlReader.CaseFolding = Sgml.CaseFolding.ToLower;
sgmlReader.InputStream = new StringReader(html);
return XElement.Load(sgmlReader);
}