NServiceBus.XmlSerialization.ForceEmptyTagsWithNewlines C# (CSharp) Method

ForceEmptyTagsWithNewlines() static private method

static private ForceEmptyTagsWithNewlines ( System.Xml.Linq.XDocument document ) : void
document System.Xml.Linq.XDocument
return void
        static void ForceEmptyTagsWithNewlines(XDocument document)
        {
            // this is to force compatibility with previous implementation,
            // in particular, to support nested objects with null properties in them.

            foreach (var childElement in 
                from x in document.DescendantNodes().OfType<XElement>()
                where x.IsEmpty && !x.HasAttributes
                select x)
            {
                childElement.Value = "\n";
            }
        }