Xmlnode_Object.AddElementNode Method

Creates a new XML element and appends it as a child of the current node. Returns an XmlNode object for the newly created element node.

…xmlnode_object.AddElementNode(element, value)

Prerequisites

The current node must be of type "element" or "document".

Parameters

element

A required String expression that specifies the name of the element to be created.

value

An optional String expression that specifies the value of the element to be created.

Remarks

This method is identical to AddElement except that it also returns an XmlNode object for the newly created element. This new node may be useful in creating additional levels in your document tree.

This is a convenience method that creates, initializes, and links a node to add an element to a DOM tree. The new element appears as the new last child of xmlnode_object.

Examples

Dim doc As XmlDoc 
Dim root As XmlNode
Dim elem As XmlNode
doc = New XmlDoc("my_doc")
root = doc.DocumentElement
elem = root.AddElementNode("section1", "Data for section 1")
elem.AddElement("section1-1", "Data for sub-section 1-1")

See Also

XML Classes | xmldoc_object.CreateNode | xmlnode_object.AddElement | xmlnode_object.SetElement