XmlElement.SetAttributeNode Method (XmlAttribute)
Adds the specified XmlAttribute.
Assembly: System.Xml (in System.Xml.dll)
The XmlAttribute node to add to the attribute collection for this element.
Return ValueType: System.Xml.XmlAttribute
If the attribute replaces an existing attribute with the same name, the old XmlAttribute is returned; otherwise, null is returned.
The newAttr was created from a different document than the one that created this node. Or this node is read-only.
The newAttr is already an attribute of another XmlElement object. You must explicitly clone XmlAttribute nodes to re-use them in other XmlElement objects.
If an attribute with that name is already present in the element, it is replaced by the new one.
Available since 10
Available since 1.1