29

Just tried using the HtmlAgility Pack for the first time and have a problem.

First I load in from a string variable.

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

Then I want to save my changes in the string NewsText. How do I do that? htmlDoc.toString() didnt work.

Thanks!

larschanders
  • 1,951
  • 3
  • 16
  • 21

1 Answers1

67

You're looking for htmlDoc.DocumentNode.OuterHtml.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964