using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' ISBN='11111111111'><title>AAA</title></book>");
//Create an attribute.
XmlAttribute attr = doc.CreateAttribute("publisher");
attr.Value = "WorldWide Publishing";
//Add the new node to the document.
doc.DocumentElement.SetAttributeNode(attr);
doc.Save(Console.Out);
}
}
|