//添加多个属性 XNamespace aw = "http://www.csdn.com"; XDocument root = new XDocument( new XElement("body", new XAttribute(XNamespace.Xmlns + "ns1", aw), new XAttribute(XNamespace.Xmlns + "ns2", aw), new XAttribute(XNamespace.Xmlns + "ns3", aw), "Content"));
"w", "wordDocument", "http://schemas.microsoft.com/office/word/2003/2/wordml");
System.Xml.XmlAttribute xa;
xa = doc.CreateAttribute("xmlns", "v", w3NameSpace);
xa.Value = "urn:schemas-microsoft-com:vml";
root.Attributes.Append(xa);//为节点添加属性
xa = doc.CreateAttribute("xmlns", "w10", w3NameSpace);
xa.Value = "urn:schemas-microsoft-com:office:word";
root.Attributes.Append(xa);xa = doc.CreateAttribute("xmlns", "SL", w3NameSpace);
xa.Value = "http://schemas.microsoft.com/schemaLibrary/2003/2/core";
root.Attributes.Append(xa);xa = doc.CreateAttribute("xmlns", "aml", w3NameSpace);
xa.Value = "http://schemas.microsoft.com/aml/2001/core";
root.Attributes.Append(xa);xa = doc.CreateAttribute("xmlns", "wx", w3NameSpace);
xa.Value = "http://schemas.microsoft.com/office/word/2003/2/auxHint";
root.Attributes.Append(xa);参考
http://dotnet.aspx.cc/article/7b4c7a42-4cdf-40d1-b293-e86da109a34c/read.aspx
//添加多个属性
XNamespace aw = "http://www.csdn.com";
XDocument root = new XDocument(
new XElement("body",
new XAttribute(XNamespace.Xmlns + "ns1", aw),
new XAttribute(XNamespace.Xmlns + "ns2", aw),
new XAttribute(XNamespace.Xmlns + "ns3", aw),
"Content"));