Removes an XML child element.

RemoveChild(String)

public bool RemoveChild(string name);
Public Function RemoveChild(ByVal name As String) As Boolean

RemoveChild(String, Int)

public bool RemoveChild(string name, int index);
Public Function RemoveChild(ByVal name As String, ByVal index As Integer) As Boolean

Parameters

Parameter Description
name Specifies the name of the sub-element to remove.
index Specifies the number of the sub-element beginning with 1. If this value does not match any existing sub-element, an error occurs.

Return Value

The return value is false, if the element could not be removed because the document becomes invalid according to the document's DTD. In this case, an XmlInvalid event occurs. The return value is true, if the sub-element could successfully be removed.

Examples

The following example removes the second Telephone element of the second address in an XML document that contains addresses consisting of the sub-elements Name, Street, City and Telephone.

textControl1.GetXmlElements("Adress").GetItem(2).RemoveChild("Telephone", 2);
TextControl1.GetXmlElements("Adress").GetItem(2).RemoveChild("Telephone", 2)