private static void ReplaceDefs(XmlNode xmlNode)
{
for (var i = 0; i < xmlNode.ChildNodes.Count; i++)
{
var childNode = xmlNode.ChildNodes[i];
ReplaceDefs(childNode);
if (childNode.Name != "defs")
{
continue;
}
var gNode = childNode.OwnerDocument.CreateElement("g", childNode.NamespaceURI);
foreach (XmlAttribute attribute in childNode.Attributes)
{
gNode.SetAttributeNode((XmlAttribute)attribute.Clone());
}
gNode.SetAttribute("display", "none");
while (childNode.HasChildNodes)
{
gNode.AppendChild(childNode.FirstChild);
}
xmlNode.ReplaceChild(gNode, childNode);
}
}