AddElementNS method: XmlNode class

Syntax

AddElementNS(NamespaceURI, TagName)

Where NamespaceURI can have one of the following forms:

URL.URLName

Or a string URL, such as:

http://www.example.com/

Description

Use AddElementNS to add a namespace element to an XmlNode. The new element is appended to the list of child nodes.

To insert a Namespace element at a particular place in the list of nodes, use the InsertElementNS method instead. A reference to the newly created element is returned. If you specify an element name that already exists, the new value you use replaces the existing value, and a reference to the element is returned.

Parameters

Parameter Description

NamespaceURI

Specify the URI that contains the Namespaces for the XmlDoc, as a string.

TagName

Specify the name of the Element that you want to create, as a string.

Returns

A reference to the newly created element if successful. If not successful, the IsNull property is set to True.

Example

Local XmlDoc &inXMLDoc;
Local XmlNode &childNode;

&inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><myroot/>");
&childNode = &inXMLDoc.DocumentElement.AddElementNS("http://www.example.com",⇒
 "child");