Answers for "how to delete a adjacency node in xmldocument in c#"

C#
0

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);
    }
}
Posted by: Guest on December-21-2020

Code answers related to "how to delete a adjacency node in xmldocument in c#"

C# Answers by Framework

Browse Popular Code Answers by Language