我需要构建一个XML文档,其中包含一个如下的SOAP信封:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
考虑到SOAP-ENV也是一个XElement,所以尝试以下代码:
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
XElement soapEnvelope = new XElement(soap + "SOAP-ENV:Envelope",
new XAttribute(XNamespace.Xmlns + "xmlns:SOAP-ENV", soap.NamespaceName),
new XElement("SOAP-ENV:Body"));
出现以下错误:
无法在名称中包含字符“:”,十六进制值为0x3A。
有什么线索吗?
提前致谢。