how to delete a adjacency node in xmldocument in c# code example
Example: how to delete a adjacency node in xmldocument in c#
public void deleteBook(XmlNode book)
{
XmlNode prevNode = book.PreviousSibling;
book.OwnerDocument.DocumentElement.RemoveChild(book);
if (prevNode.NodeType == XmlNodeType.Whitespace ||
prevNode.NodeType == XmlNodeType.SignificantWhitespace)
{
prevNode.OwnerDocument.DocumentElement.RemoveChild(prevNode);
}
}