You need to import the node into the document before appending it:
XmlNode oNode = moDoc.CreateNode(sNodeType, sName, sNamespaceURI);
//necessary for crossing XmlDocument contexts
XmlNode importNode = oParent.OwnerDocument.ImportNode(oNode, true);
oParent.AppendChild(importNode);
return oNode;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With