SgmlReader r = new SgmlReader();
r.DocType = "HTML";
r.InputStream = new StringReader(temp);
StringWriter sw = new StringWriter();
XmlTextWriter w = new XmlTextWriter(sw);
while (!r.EOF)
{
w.WriteNode(r, true);
}
w.Close();
string temp2 = sw.ToString();
XmlDocument xmldom = new XmlDocument();
xmldom.LoadXml(temp2);
转载于:https://www.cnblogs.com/lovebanyi/archive/2006/04/20/379779.html