Adds a new XMLElement object as a sub-element of this element. The new element is placed at the position specified through the document's DTD. If this element can have more than one child of the specified type the before or after parameters can be used to specify a position.
XMLElement.AddChild XMLElement[, before][, after]
Specifies an XMLElement object.
Optional. Specifies a relative position in the list of child elements of the specified type. The XML element to be added is placed before the child identified by the before parameter. You can specify before or after positions but not both.
Optional. Specifies a relative position in the list of child elements of the specified type. The XML element to be added is placed after the child identified by the after parameter. You can specify before or after positions but not both.
The method returns one of the following values:
|0||An error has occurred.|
|1||The new element could not be added because the document becomes invalid according to the document's DTD. In this case Text Control fires an XMLInvalid event.|
|2||The new element has been successfully added.|
The following Basic example creates a new "Telephone" element and adds it to the second address in an XML document that contains addresses consisting of the sub-elements Name, Street, City and Telephone:
Dim NewElement As Object Set NewElement = CreateObject("TIS.TX.XMLElement.26") NewElement.ElementName = "Telephone" NewElement.Text = "034568-782346" TXTextControl1.XMLElements("Address")(2).AddChild NewElement