Removing Nodes from the DOM

To remove a node from the XML Document Object Model (DOM), use the RemoveChild method to remove a specific node. When you remove a node, the method removes the subtree belonging to the node being removed; that is, if it is not a leaf node.

To remove multiple nodes from the DOM, use the RemoveAll method to remove all the children and attributes, if applicable, of the current node.

If you are working with an XmlNamedNodeMap, you can remove a node using the RemoveNamedItem method.

To remove attributes, see Removing Attributes from an Element Node in the DOM.

See also