2011-02-24 78 views
22

剛試過第一次使用HtmlAgility Pack並出現問題。HtmlAgility - 將解析保存爲字符串

首先我從字符串變量中加載。

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

然後我想將我的更改保存在字符串NewsText中。我怎麼做? htmlDoc.toString()沒有工作。

謝謝!

回答

57

您正在查找htmlDoc.DocumentNode.OuterHtml

+0

工作很好!謝謝! – larschanders 2011-02-25 08:35:58