Adds the specified XmlAttribute.
[Visual Basic] Overloads Overridable Public Function SetAttributeNode( _ ByVal newAttr As XmlAttribute _ ) As XmlAttribute [C#] public virtual XmlAttribute SetAttributeNode( XmlAttribute newAttr ); [C++] public: virtual XmlAttribute* SetAttributeNode( XmlAttribute* newAttr ); [JScript] public function SetAttributeNode( newAttr : XmlAttribute ) : XmlAttribute;
If the attribute replaces an existing attribute with the same name, the old XmlAttribute node is returned; otherwise, null is returned.
Exception Type | Condition |
---|---|
WRONG_DOCUMENT_ERR | The newAttr was created from a different document than the one that created this node. |
NO_MODIFICATION_ALLOWED_ERR | This node is read-only. |
INUSE_ATTRIBUTE_ERR | The newAttr is already an attribute of another XmlElement object. You must explicitly clone XmlAttribute nodes to re-use them in other XmlElements. |
If an attribute with that name is already present in the element, it is replaced by the new one.
XmlElement Class | XmlElement Members | System.NewXml Namespace | XmlElement.SetAttributeNode Overload List