I am trying to create an xml with the following code.
XmlDocument xmlDocument = new XmlDocument();
XmlProcessingInstruction xPI = xmlDocument.CreateProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
xmlDocument.AppendChild(xPI);
XmlElement xElmntheader = xmlDocument.CreateElement("soapenv:Header", " ");
xmlDocument.AppendChild(xElmntheader);
MemoryStream ms = new MemoryStream();
xmlDocument.Save(ms);
string text = System.Text.Encoding.GetEncoding("UTF-8").GetString(ms.GetBuffer(), 0, (int)ms.Length);
Output is
<xml version='1.0' encoding='UTF-8'?>
<soapenv:Header xmlns:soapenv=" " />
I was trying to create like this
<xml version='1.0' encoding='UTF-8'?>
<soapenv:Header/>
How do I eliminate xmlns:soapenv=" " from soapenv:Header?
Any help would be greatly appreciated.
soapenv.