public static void WhitespacesBereinigen(XmlNode node)
 {
     if (node != null)
     {
         ArrayList arrayList  = new ArrayList();
         ArrayList arrayList2 = new ArrayList();
         foreach (XmlNode childNode in node.ChildNodes)
         {
             if (childNode is XmlWhitespace)
             {
                 arrayList.Add(childNode);
             }
             else if (childNode is XmlElement)
             {
                 arrayList2.Add(childNode);
             }
         }
         foreach (XmlWhitespace item in arrayList)
         {
             if (item.Data.IndexOf(" ") != -1)
             {
                 XmlText newChild = item.OwnerDocument.CreateTextNode(" ");
                 item.ParentNode.ReplaceChild(newChild, item);
             }
             else
             {
                 item.ParentNode.RemoveChild(item);
             }
         }
         foreach (XmlNode item2 in arrayList2)
         {
             ToolboxXML.WhitespacesBereinigen(item2);
         }
     }
 }
Ejemplo n.º 2
0
        public static void WhitespacesBereinigen(XmlNode node)
        {
            if (node == null)
            {
                return;
            }
            ArrayList arrayList1 = new ArrayList();
            ArrayList arrayList2 = new ArrayList();

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode is XmlWhitespace)
                {
                    arrayList1.Add((object)childNode);
                }
                else if (childNode is XmlElement)
                {
                    arrayList2.Add((object)childNode);
                }
            }
            foreach (XmlWhitespace xmlWhitespace in arrayList1)
            {
                if (xmlWhitespace.Data.IndexOf(" ") != -1)
                {
                    XmlText textNode = xmlWhitespace.OwnerDocument.CreateTextNode(" ");
                    xmlWhitespace.ParentNode.ReplaceChild((XmlNode)textNode, (XmlNode)xmlWhitespace);
                }
                else
                {
                    xmlWhitespace.ParentNode.RemoveChild((XmlNode)xmlWhitespace);
                }
            }
            foreach (XmlNode node1 in arrayList2)
            {
                ToolboxXML.WhitespacesBereinigen(node1);
            }
        }