TX Text Control ActiveX

Add Method

Method

Adds a new XMLElement object to the collection.

Syntax

XMLElements.Add XMLElement[, before][, after]

Parameters

ParameterDescription
XMLElementSpecifies an XMLElement object.
beforeOptional. 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.
afterOptional. 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.

Return Value

ValueDescription
0An error has occurred.
1The 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.
2The new element has successfully been added.

Data Types

NameData type
XMLElementXMLElement Object
beforeLong
afterLong
Return valueInteger

Examples

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.34")
NewAddress.Text = "Jack Brown" & Chr(10) _
& "Baker Street" & Chr(10) & "New York"
TXTextControl1.XMLElements("Address").Add NewAddress, , 2

See Also