I\'m trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g.
XNamespace ns = \"http
If one element uses a namespace, they all must use one. In case you don't define one on your own the framework will add a empty namespace as you have noticed. And, sadly, there is no switch or something similiar to suppress this "feature".
So, there seems to be no better method as to strip it out. Using Replace(" xmlns=\"\"", "") could be a little bit faster than executing a RegEx.