Adds a new XMLElement object to the collection.
XMLElements.Add XMLElement[, before][, after]
Parameter | Description | |
XMLElement |
Specifies an XMLElement object. |
|
before |
Optional. Specifies a relative position in the collection. The XML element to be added is placed in the collection before the member identified by the before parameter. It must be a number from 1 to the value of the collection's Count property. If this parameter is zero, the new element is inserted before the element at the current input position. You can specify before or after positions but not both. |
|
after |
Optional. Specifies a relative position in the collection. The XML element to be added is placed in the collection after the member identified by the after parameter. It must be a number from 1 to the value of the collection's Count property. If this parameter is zero the new element is inserted after the element at the current input position. You can specify before or after positions but not both. |
Parameter | Description | |
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 successfully been added. |
XMLElement: | XMLElement Object |
before: | Long |
after: | Long |
Return value: | Integer |
The following Basic example inserts a new Address element in an XML document that contains addresses consisting of the sub-elements Name, Street and City. The new address is inserted after the second address:
Dim NewAddress As Object Set NewAddress = CreateObject("TIS.TX.XMLElement.32") NewAddress.Text = "Jack Brown" & Chr(10) _ & "Baker Street" & Chr(10) & "New York" TXTextControl1.XMLElements("Address").Add NewAddress, , 2