Hello,
I am creating an XML Document using XmlDocument.
I can create my top node no problem
However when I add child nodes they seem to inherit the xmlns=""
attribute (see xml below).
How can I stop this?
-------------------------
Code snippet
-------------------------
n = xmlDoc.CreateElement("nl", "MyXML", "http://www.myurl.com");
XmlAttribute nns = xmlDoc.CreateAttribute( "xmlns" );
nns.InnerText = @"www.myurl.com/xml";n.Attributes.SetNamedItem( nns );
xmlDoc.AppendChild(n);
XmlNode TemplateNode;
TemplateNode = xmlDoc.CreateElement("Template");
n.AppendChild(TemplateNode);
---------------------
Resulting XML
---------------------
<?xml version="1.0" encoding="UTF-8"?>
<nl:MyXML xmlns="http://www.myurl.com/xml"
xmlns:vl="http://www.myurl.com">
<Template xmlns="">
</Template>
</vl:VNETList>