<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-
envelope.xsd">
XmlDocument xmldoc = new XmlDocument();
XmlElement xmlelem;
XmlElement data;
xmlelem = xmldoc.CreateElement("", "AmazonEnvelope", "");
//xmlelem.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
//xmlelem.SetAttribute("xsi","noNamespaceSchemaLocation", "amzn-envelope.xsd");
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XAttribute att = new XAttribute(xsi + "noNamespaceSchemaLocation", "amzn-envelope.xsd") ;
我直接用setAttribute不行
网上有一个用XDocument的但是我用的是XmlDocument,不想改了
为什么没人啊