HtmlAgilityPack.HtmlNode.AppendChild C# (CSharp) Method

AppendChild() public method

Adds the specified node to the end of the list of children of this node.
public AppendChild ( HtmlNode newChild ) : HtmlNode
newChild HtmlNode The node to add. May not be null.
return HtmlNode
		public HtmlNode AppendChild(HtmlNode newChild)
		{
			if (newChild == null)
			{
				throw new ArgumentNullException("newChild");
			}

			ChildNodes.Append(newChild);
			_ownerdocument.SetIdForNode(newChild, newChild.GetId());
			_outerchanged = true;
			_innerchanged = true;
			return newChild;
		}

Usage Example

 private static void AddContentRegions(Dictionary<string, HtmlNode> contentNodes, HtmlNode bodyNode)
 {
     foreach (var contentNode in contentNodes)
     {
         var titleNode = CreateContentTitleNode(contentNode);
         var linkNode = CreateContentLinkNode(titleNode);
         var headerNode = CreateContentHeaderNode(linkNode);
         bodyNode.AppendChild(headerNode);
     }
 }
All Usage Examples Of HtmlAgilityPack.HtmlNode::AppendChild