Hi there,
I have this
The body:
<body><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent leo leo, ultrices eu venenatis et, rutrum fringilla dolor.</p></body>
The code:
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)
{
replaceNode.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?
The result:
// body.InnerHtml
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent leo leo, ultrices eu venenatis et, rutrum fringilla dolor.</p>
// body.OutterHtml
<body><p>Lorem ipsum dolor sit amet...</p></body>