There's a post on MSDN blogs that shows how easy it is to get around this (reasonably). Before you output XML, you will want to execute this code:
foreach (XElement e in root.DescendantsAndSelf()) { if (e.Name.Namespace == string.Empty) { e.Name = ns + e.Name.LocalName; } }
The alternative, as the poster mentions, is to prefix each element name with a namespace as it is added, but this seems like a nicer solution, as it is more automated and saves a bit of input.
source share