当前位置: 首页 > 工具软件 > SGMLReader > 使用案例 >

用 SGMLReader把子HTML 转 XML

袁华清
2023-12-01
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

 类似资料: