Example #1
0
        /// <summary>
        /// Removes all Tags of the given type. Doesnt traverse the tree
        /// </summary>
        /// <param name="type">Type of the tags that should be removed</param>
        /// <returns>true when tags were removed, false when no tags were found and removed</returns>
        public bool RemoveTags(Type type)
        {
            bool ret = false;

            ElementList list = SelectElements(type);

            if (list.Count > 0)
            {
                ret = true;
            }

            foreach (Element e in list)
            {
                e.Remove();
            }

            return(ret);
        }
Example #2
0
 private ElementList _SelectElements(Element e, string tagname, ElementList es, bool traverseChildren)
 {
     if (e.ChildNodes.Count > 0)
     {
         foreach (Node n in e.ChildNodes)
         {
             if (n.NodeType == NodeType.Element)
             {
                 if (((Element)n).m_TagName == tagname)
                 {
                     es.Add(n);
                 }
                 if (traverseChildren)
                 {
                     _SelectElements((Element)n, tagname, es, true);
                 }
             }
         }
     }
     return(es);
 }
Example #3
0
 private ElementList _SelectElements(Element e, Type type, ElementList es, bool traverseChildren)
 {
     if (e.ChildNodes.Count > 0)
     {
         foreach (Node n in e.ChildNodes)
         {
             if (n.NodeType == NodeType.Element)
             {
                 if (n.GetType() == type)
                 {
                     es.Add(n);
                 }
                 if (traverseChildren)
                 {
                     _SelectElements((Element)n, type, es, true);
                 }
             }
         }
     }
     return(es);
 }
Example #4
0
 /// <summary>
 /// returns a nodelist of all found nodes of the given Type
 /// </summary>
 /// <param name="e"></param>
 /// <param name="type"></param>
 /// <param name="es"></param>
 /// <returns></returns>
 private ElementList _SelectElements(Element e, Type type, ElementList es)
 {
     return(_SelectElements(e, type, es, false));
 }
Example #5
0
        public ElementList SelectElements(System.Type type)
        {
            ElementList es = new ElementList();

            return(_SelectElements(this, type, es));
        }