This documentation is archived and is not being maintained.

XmlAttribute Class

Represents an attribute. Valid and default values for the attribute are defined in a DTD or schema.

For a list of all members of this type, see XmlAttribute Members.


[Visual Basic]
Public Class XmlAttribute
   Inherits XmlNode
public class XmlAttribute : XmlNode
public __gc class XmlAttribute : public XmlNode
public class XmlAttribute extends XmlNode

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Attributes can be associated with an element. Use the OwnerElement property to get the XmlElement to which to the attribute belongs.

The XmlElement class has several methods which allow you to access attribute nodes (XmlElement.GetAttribute, XmlElement.SetAttribute, XmlElement.RemoveAttribute, and so on). Additionally, you can call the XmlElement.Attributes property which returns an XmlAttributeCollection enabling you to access attributes by name or index from the collection.


Namespace: System.Xml

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

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

See Also

XmlAttribute Members | System.Xml Namespace | Accessing Attributes in the DOM | Unordered Node Retrieval by Name or Index | XML Document Object Model (DOM) | Specified | XmlDocument.CreateAttribute