Export (0) Print
Expand All

XmlElement.SetAttributeNode Method (XmlAttribute)

Adds the specified XmlAttribute.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

'Declaration
Public Overridable Function SetAttributeNode ( _
	newAttr As XmlAttribute _
) As XmlAttribute

Parameters

newAttr
Type: System.Xml.XmlAttribute
The XmlAttribute node to add to the attribute collection for this element.

Return Value

Type: System.Xml.XmlAttribute
If the attribute replaces an existing attribute with the same name, the old XmlAttribute is returned; otherwise, Nothing is returned.

ExceptionCondition
ArgumentException

The newAttr was created from a different document than the one that created this node. Or this node is read-only.

InvalidOperationException

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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft