System.Xml.XmlDocument.CreateAttribute Method

Creates an System.Xml.XmlAttribute with the specified XmlNode.Prefix, XmlDocument.LocalName, and XmlNode.NamespaceURI.

Syntax

public virtual XmlAttribute CreateAttribute (string prefix, string localName, string namespaceURI)

Parameters

prefix
The prefix of the attribute (if any). String.Empty and null are equivalent.
localName
The local name of the attribute.
namespaceURI
The namespace URI of the attribute (if any). String.Empty and null are equivalent. If prefix is xmlns, then this parameter must be http://www.w3.org/2000/xmlns/; otherwise an exception is thrown.

Returns

The new XmlAttribute.

Remarks

The XmlAttribute can be added to an System.Xml.XmlElement using the XmlElement.SetAttributeNode(XmlAttribute) method.

This method is a Microsoft extension to the Document Object Model (DOM).

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0