CSharp examples for System.Xml:XML Attribute
Adds an attribute with a specified name and value to an existing XmlNode.
// Permission is hereby granted, free of charge, to any person obtaining using System.Xml; using System.Globalization; using System.Collections.Generic; using System;/* www .ja v a 2 s . c o m*/ public class Main{ /// <summary> /// Adds an attribute with a specified name and value to an existing XmlNode. /// </summary> /// <param name="node">The node to which the attribute should be added.</param> /// <param name="name">The name of the attribute.</param> /// <param name="value">The value of the attribute.</param> public static void AddAttribute(this XmlNode node, string name, string value) { XmlAttribute attr = node.OwnerDocument.CreateAttribute(name); attr.Value = value; node.Attributes.Append(attr); } }