alesiamarjorie
New Member
When I remove a node (with \[code\]keepGrandChildren\[/code\]) that has both text and child nodes inside, the text is pushed all the way after the child nodes, rather than stay in its original location.Example:\[code\]var doc = new HtmlDocument();doc.LoadHtml(@"<span id='first'> This text comes first. <span id='second'>This text comes second.</span></span>");var node = doc.GetElementbyId("first");node.ParentNode.RemoveChild(node, true);doc.Save(Console.Out);\[/code\]The output that I get is:\[code\] <span id='second'>This text comes second.</span> this text comes first.\[/code\]Instead of:\[code\] this text comes first. <span id='second'>This text comes second.</span>\[/code\]
Is there any way of removing a node using \[code\]keepGrandChildren\[/code\] without the text inside getting pushed towards the end?
I want to conserve absolute order and make sure that no text or nodes change their original position, otherwise the document will be ruined.Edit:I'm using \[code\]HtmlAgilityPack 1.4.6.0\[/code\] and \[code\].NET 4.0\[/code\]
Is there any way of removing a node using \[code\]keepGrandChildren\[/code\] without the text inside getting pushed towards the end?
I want to conserve absolute order and make sure that no text or nodes change their original position, otherwise the document will be ruined.Edit:I'm using \[code\]HtmlAgilityPack 1.4.6.0\[/code\] and \[code\].NET 4.0\[/code\]