I am generating XML file from C# code but when I add attribute to XML node I am getting problem. Following is code.
XmlDocument doc = new XmlDocument();
XmlNode docRoot = doc.CreateElement("eConnect");
doc.AppendChild(docRoot);
XmlNode eConnectProcessInfo = doc.CreateElement("eConnectProcessInfo");
XmlAttribute xsiNil = doc.CreateAttribute("xsi:nil");
xsiNil.Value = "true";
eConnectProcessInfo.Attributes.Append(xsiNil);
docRoot.AppendChild(eConnectProcessInfo);
Result:
<eConnect>
<eConnectProcessInfo nil="true"/>
</eConnect>
Expected Result:
<eConnect>
<eConnectProcessInfo xsi:nil="true"/>
</eConnect>
XML attribute is not adding "xsi:nil" in xml file. Please help me for this, where I am going wrong.