Skip to content

AddElement - cXMLDOMElement

Creates a new node and appends it to the list

Type: Function
Return Data Type: Handle

Parameters

Parameter Type Description
sTagName String The name of the Element Tag
sValue String Value of the element

Syntax

Function AddElement String sTagName String sValue Returns Handle

Call Example

Get AddElement sTagName sValue to HandleVariable

Description

AddElement is not namespace aware and only works reliably for attributes with no namespaces and no prefixes. You should use AddElementNS in its place.

AddElement creates a new node and appends it to the list.

Example

Get AddElement of hoRoot sFile "" to hoTable

This sample creates a a new node element and returns a handle to the element.

The two following examples yield the same result:

Get AddElement Of hoRow 'CUSTOMERNAME' Customer.Name To hoField

Get AddElement Of hoRow 'CUSTOMERNAME' '' To hoField
If (hoField <> 0) Begin
    Set psText Of hoField To Customer.Name
End
Col 1 Col 2
Note: You are encouraged to check the value of hoField after the Get AddElement is executed because hoField will be zero if the operation failed for any reason (e.g. when sFieldName is blank.)

Return Value

Returns an object handle to a newly created XML node object. If zero, the object could not be created.