0
我正在創建一個XDocument,如下所示。對於TestId,LoginData和InterfaceVersion元素,輸出具有xmlns =「」。我不想爲這些元素使用xmlns =「」。如何抑制這一點?XNamespace/XElement
XNamespace aw = "http://test.com/xml/DatabaseService/TestData";
XDocument xw = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
new XElement(aw + "TestData", new XAttribute("version", "1.0"),
new XElement("TestId", new XAttribute("Id", strPublishedId)),
new XElement("LoginData", new XAttribute("User", "none"), new XAttribute("Password", "nothing"), new XAttribute("Domain", "")),
new XElement("InterfaceVersion", new XAttribute("Major", "1"), new XAttribute("Minor", "0"))));
在此先感謝。