private void DeleteChildren()
{
switch (NodeType)
{
case XPathNodeType.Namespace:
throw new InvalidOperationException("Removing namespace node content is not supported.");
case XPathNodeType.Attribute:
return;
case XPathNodeType.Text:
case XPathNodeType.SignificantWhitespace:
case XPathNodeType.Whitespace:
case XPathNodeType.ProcessingInstruction:
case XPathNodeType.Comment:
DeleteSelf();
return;
}
if (!HasChildren)
{
return;
}
XPathNavigator nav = Clone();
nav.MoveToFirstChild();
while (!nav.IsSamePosition(this))
{
nav.DeleteSelf();
}
}