HtmlAgility - 将解析保存为字符串

lar*_*ers 25 c# parsing html-parsing

刚尝试首次使用HtmlAgility Pack并遇到问题.

首先我从字符串变量加载.

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

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

谢谢!

SLa*_*aks 61

你在找htmlDoc.DocumentNode.OuterHtml.