How is it possible to force extra spacing between some nodes using Linq to Xml? I am looking to output the following:
<root>
<group>
<leaf />
</group>
<group>
<leaf />
</group>
</root>
By adding Empty XText, it only destroys the formatting.
var root =
new XElement("root",
new XText(""),
new XElement("group",
new XElement("leaf")),
new XText(""),
new XElement("group",
new XElement("leaf")),
new XText(""));
Console.WriteLine(root.ToString());
resulting in
<root><group><child /></group><group><child /></group></root>