Xmlnode_Object.AppendChildMethod

Appends a new node as the new last child of the current node. Text nodes are merged as appropriate.

xmlnode_object.AppendChild(new_node)

Prerequisites

None

Parameters

new_node

A required XmlNode object that is to be appended.

Remarks

This method appends a node to the specified node. The new node becomes the last child of the specified node. If a text node is being appended to an element whose last child is already a text node, the new text is merged with the old text node and the new node is freed.

The node to be added may be created by XmlDoc.CreateNode or may have been removed from the tree using RemoveChild. If you are appending a new attribute or element, it is more convenient to use AddAttribute or AddElement.

You cannot append a node that is a member of one document tree to a different document tree. Use the Clone method to make a copy of a node from a different document.

Examples

Dim doc As XmlDoc 
Dim root As XmlNode
Dim elem As XmlNode
Dim text As XmlNode
doc = New XmlDoc("my_doc")
root = doc.DocumentElement
elem = doc.CreateNode("element", "section1")
text = doc.CreateNode("text")
text.value = "This is the data for section 1"
elem.AppendChild(text)
root.AppendChild(elem)

See Also

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