Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to avoid omitted namespace on OuterXml

$
0
0
When trying to build SOAP request using XmlDocument
when calling myXmlDocument.OuterXml - it omits the "tns:" which breaks the SOAP request

Simplest code to show the problem follows:

var doc = new XmlDocument();
    doc.LoadXml("<Root />");
    XmlNode node = doc.CreateElement("tns:MyNode");
    string nodeName = node.Name;    // "tns:MyNode"
    string nodeXml = node.OuterXml; // "<MyNode />"
    // Why OuterXml does not show the correct node.Name

Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>