C# 使用LINQ到XML构建SOAP信封
我必须构造一个XML文档,它有一个SOAP信封,如下所示:C# 使用LINQ到XML构建SOAP信封,c#,xml,linq,C#,Xml,Linq,我必须构造一个XML文档,它有一个SOAP信封,如下所示: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> 给出此错误: “:”字符(十六进制值0x3A)不能包含在 名字 有什么线索吗 提前谢谢。试试这个 XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/"
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
给出此错误:
“:”字符(十六进制值0x3A)不能包含在
名字
有什么线索吗
提前谢谢。试试这个
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
XElement element = new XElement(soap + "Envelope",
new XAttribute(XNamespace.Xmlns + "SOAP-ENV", soap),
new XElement(soap + "Body"));
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
XElement element = new XElement(soap + "Envelope",
new XAttribute(XNamespace.Xmlns + "SOAP-ENV", soap),
new XElement(soap + "Body"));