I have a XML document that I load and this has namespaces on it.
I then create a series of document fragments and place these into another XmlDocument. In my main docuement, I then navigate to the place where I want to insert my second document.
This all appears to work fine, my document fragments placed in an XmlDocument of their own all look fine. I add them into the correct place of the master document, but then it adds an attribute of xmlns="" to my newly inserted section. I do not want this to appear, it also blows out when validating against my xsd because of this unexpected attribute. Is there any way I can stop this from being generated?
interogatting xmlRisks (line 1) looks ok, my element does not contain the xmlns attribute by the time the 3rd line is run and I check the main document(xmlInput), my newly inserted section has the empty namespace added to first element.
XmlNode totalDoc = xmlInput.ImportNode(xmlRisks.DocumentElement, true);
XmlPath itemsInsertPoint = _xmlPathRepository.Queryable<XmlPath>().Where(r => r.SectionName == "All" && r.Type == "I" && r.Level == "S").Single();
expecting: <Items><Item>.........but received <Items><Item xmlns="">......