I\'m trying to create an XmlDocument
using C# and .NET (version 2.0.. yes, version 2.0). I have set the namespace attributes using:
document.Doc
Maybe you could share what you're expecting as final XML document.
However from what I understand you want to do that looks like:
so the code to do that would be:
XmlDocument document = new XmlDocument();
document.LoadXml(" ");
string soapNamespace = "http://schemas.xmlsoap.org/soap/envelope/";
XmlAttribute nsAttribute = document.CreateAttribute("xmlns","soapenv","http://www.w3.org/2000/xmlns/");
nsAttribute.Value = soapNamespace;
document.DocumentElement.Attributes.Append(namespaceAttribute);
document.DocumentElement.AppendChild(document.CreateElement("Header",soapNamespace));