Search code examples
c#xmlxml-namespacesxelement

Empty xmlns is created


I add an Xelement to a parent Xelement:

rootElement.Add(schemaRootTag);  

The new XML element has an empty xmlns attribute like: xmlns="".

Any ideas?


Solution

  • This has been asked here before. It's all to do with how you create the XElement: https://stackoverflow.com/a/12039383/616304