Attribute with namespace
using System; using System.Linq; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass{ public static void Main(){ XNamespace aw = "http://www.domain.com"; XElement xmlTree = new XElement(aw + "Root", new XAttribute(XNamespace.Xmlns + "aw", "http://www.domain.com"), new XAttribute(aw + "Att", "attribute content") ); XAttribute att = xmlTree.Attribute(aw + "Att"); Console.WriteLine(att); } }