TXTextControl.XmlElement.RemoveChild Method

Removes an XML child element.

RemoveChild(String)

Removes the first XML child element with the specified name.

[C#]
public bool RemoveChild(string name);
[Visual Basic]
Public Function RemoveChild(ByVal name As String) As Boolean
Parameter Description
name

Specifies the name of the sub-element to remove.

RemoveChild(String, Int32)

Removes the XML child element with the specified name and index.

[C#]
public bool RemoveChild(string name, int index);
[Visual Basic]
Public Function RemoveChild(ByVal name As String, ByVal index As Integer) As Boolean
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.

Example

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

[C#]
textControl1.GetXmlElements("Adress").GetItem(2).RemoveChild("Telephone", 2);
[Visual Basic]
TextControl1.GetXmlElements("Adress").GetItem(2).RemoveChild("Telephone", 2)

See Also