HtmlAgility – 将解析保存为字符串

刚试过第一次使用HtmlAgility Pack并遇到问题。

首先我从一个字符串变量加载。

string NewsText = dr["Message"].ToString(); HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(NewsText); //doing my stuff... 

然后我想将我的更改保存在字符串NewsText中。 我怎么做? htmlDoc.toString()没有用。

谢谢!

您正在寻找htmlDoc.DocumentNode.OuterHtml