InsertAfter() public method

Inserts the specified node immediately after the specified reference node.
public InsertAfter ( HtmlNode newChild, HtmlNode refChild ) : HtmlNode
newChild HtmlNode The node to insert. May not be null.
refChild HtmlNode The node that is the reference node. The newNode is placed after the refNode.
return HtmlNode
Exemplo n.º 1
0
		public static void RemoveChildKeepGrandChildren ( HtmlNode parent , HtmlNode oldChild )
		{
			if ( oldChild.ChildNodes != null )
			{
				HtmlNode previousSibling = oldChild.PreviousSibling;
				foreach ( HtmlNode newChild in oldChild.ChildNodes )
				{
					parent.InsertAfter ( newChild , previousSibling );
					previousSibling = newChild;  // Missing line in HtmlAgilityPack
				}
			}
			parent.RemoveChild ( oldChild );
		}