Regrading this code:
var tmpNewNode = xdoc.ImportNode(newNode, true); if (oldNode.ParentNode != null) { oldNode.ParentNode.ReplaceChild(tmpNe
Finally i solved this opening xml file and replace all ocurrences of xmlns "" with a empty string.
Maybe its not elegant solution but its simple and works fine.
//remove void xmlns File.WriteAllText(filename, Regex.Replace(File.ReadAllText(filename), "xmlns=\"\"", ""));