Xmlnode_Object AddAttribute Method

Creates a new XML attribute and appends it as a child of the current tree node.
xmlnode_object.AddAttribute(attribute, value)

Prerequisites

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

Parameters

attribute

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

value

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

Remarks

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

Examples

Dim doc As XmlDoc 
Dim root As XmlNode
doc = New XmlDoc("my_doc")
root = doc.DocumentElement
root.AddAttribute("color", "orange")

See Also

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