public static void Main()
{
var xml = new XmlDocument();
var root = xml.CreateElement("element");
// Creates an attribute, so the element will now be "<element attribute='value' />"
root.SetAttribute("attribute", "value");
...