AddElement - cXMLDOMDocument

Creates a new node and appends it to the list

Type: Function

Return Data Type: Handle

Parameters: String sTagName String sValue

ParameterDescription
sTagNameThe name of the Element Tag
sValueValue of the element


Return Value

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


Syntax
Function AddElement String sTagName String sValue Returns Handle

Call: 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


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.)