Пример #1
0
        private static String RemoveComment(String xml)
        {
            XMLParser p = new XMLParser(xml, true);

            XmlNode     any = p.GetNode("//*");
            XmlDocument doc = any.OwnerDocument;

            XmlNodeList nl = p.GetNodes("//*[@comment='true']");

            if (nl != null)
            {
                for (int i = 0; i < nl.Count; i++)
                {
                    XmlNode node = nl[i];
                    if (node != null && node.ParentNode != null)
                    {
                        node.ParentNode.RemoveChild(node);
                    }
                }
            }

            return(XMLWriter.Format(doc));
        }