HtmlAgilityPack.HtmlNode.RemoveAllChildren C# (CSharp) Method

RemoveAllChildren() public method

Removes all the children of the current node.
public RemoveAllChildren ( ) : void
return void
		public void RemoveAllChildren()
		{
			if (!HasChildNodes)
			{
				return;
			}

			if (_ownerdocument.OptionUseIdAttribute)
			{
				// remove nodes from id list
				foreach(HtmlNode node in _childnodes)
				{
					_ownerdocument.SetIdForNode(null, node.GetId());
				}
			}
			_childnodes.Clear();
			_outerchanged = true;
			_innerchanged = true;
		}

Usage Example

示例#1
0
 HtmlNode GetStrippedForm(HtmlNode OriginalForm, List<string> InputElementStrings)
 {
     OriginalForm.RemoveAllChildren();
     foreach (string InputElementString in InputElementStrings)
     {
         HTML InputHtml = new HTML(InputElementString);
         OriginalForm.AppendChild(InputHtml.Html.DocumentNode.FirstChild);
     }
     return OriginalForm;
 }
All Usage Examples Of HtmlAgilityPack.HtmlNode::RemoveAllChildren