Constructing a SOAP envelope using LINQ to XML



I have to construct an XML document which has a SOAP envelope like so:



<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://ift.tt/sVJIaE">
<SOAP-ENV:Body>


Thought that SOAP-ENV is also a XElement, so tried like this:



XNamespace soap = "http://ift.tt/sVJIaE";
XElement soapEnvelope = new XElement(soap + "SOAP-ENV:Envelope",
new XAttribute(XNamespace.Xmlns + "xmlns:SOAP-ENV", soap.NamespaceName),
new XElement("SOAP-ENV:Body"));


gives this error:



The ':' character, hexadecimal value 0x3A, cannot be included in a name.



Any clues?


Thanks in advance.


No comments:

Post a Comment