Remove Empty XML Nodes
Remove nodes like
(without attributes & without children)
public static void RemoveEmptyNodes(XmlDocument doc)
{
XmlNodeList nodes = doc.SelectNodes("//node()");
foreach (XmlNode node in nodes)
if ((node.Attributes.Count == 0) && (node.ChildNodes.Count == 0))
node.ParentNode.RemoveChild(node);
}