Export (0) Print
Expand All

XmlElement.SetAttributeNode Method (XmlAttribute)

Adds the specified XmlAttribute.

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

public virtual XmlAttribute SetAttributeNode(
	XmlAttribute newAttr
)

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, null 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.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

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

.NET Framework

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

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft