1
下面的C#代码生成一个XML文件:C#:显式命名空间中生成的XML没有出现
XmlDocument requestXML = new XmlDocument();
XmlDeclaration declaration = requestXML.CreateXmlDeclaration("1.0", "utf-8", null);
requestXML.AppendChild(declaration);
XmlElement soapEnvelope = requestXML.CreateElement("soap:Envelope");
soapEnvelope.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
soapEnvelope.SetAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
soapEnvelope.SetAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
我看到在requestXML.OuterXML
XML显示
<Envelope ...>
而不是
<soap:Envelope ...>
正如我所料。我究竟做错了什么?
那么,这是不容易的! – 2009-12-30 18:17:35