Xmlnode_Object SetAttribute Method

Changes the value of an existing attribute.
xmlnode_object.SetAttribute(attribute, new_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 changed.

new_value

A required String expression that specifies the new value of the attribute.

Remarks

This is a convenience method that modifies an attribute value in a DOM tree. The new_value replaces the old value of the attribute. The attribute must be an immediate child of the current node. If the attribute is not found, an exception is thrown.

Examples

Dim doc As XmlDoc 
Dim root As XmlNode
doc = New XmlDoc("my_doc")
root = doc.DocumentElement
root.AddAttribute("color", "orange")
root.SetAttribute("color", "green") ' Change color to "green"

See Also

XML Classes | xmlnode_object.GetAttribute | xmlnode_object.SetElement