CSharp examples for System.Xml:XML Attribute
Create XML Attribute
// All rights reserved. using System.Diagnostics; using System.Collections.Specialized; using System.Xml; using System.Data; using System;/*from ww w. jav a2s .co m*/ public class Main{ public static XmlAttribute CreateAttribute( XmlNode node, string attributeName, string value ) { XmlDocument doc = node.OwnerDocument; XmlAttribute attr = null; // create new attribute attr = doc.CreateAttribute( attributeName ); attr.Value = value; // link attribute to node node.Attributes.SetNamedItem( attr ); return attr; } }