This project has moved and is read-only. For the latest updates, please go here.

ReplaceNode doesn’t change the InnerHTML of the Body

Topics: User Forum
Apr 7, 2010 at 12:22 PM

Hi there,

I have this

HtmlNode body = doc.DocumentNode.SelectSingleNode("//body");

Dictionary<HtmlNode, HtmlNode> toReplace = new Dictionary<HtmlNode, HtmlNode>();

// I do some logic here adding nodes to the toReplace dictionary.

foreach (HtmlNode replaceNode in toReplace.Keys)
.ParentNod.ReplaceChild(toReplace[replaceNode], replaceNode);

After i do this, the InnerHtml of the body node remains the same as from beginning, although the OutterHtml or the InnerText are showing the good result. Is there something wrong with my code?