Esempio n. 1
0
        public static string CleanUnwantedHtml(string html, string encode, params HtmlTag[] Tags)
        {
            var tags = Tags.ToList();

            var ha = new HTMLAgility();

            html = ha.RemoveUnwantedHtmlTags(html, encode, tags.Where(t => t.RemoveAllTag).Select(t => t.Tag).ToList());



            tags.Where(t => t.RemoveAllTag == false && t.AttributeToRemove != null && t.AttributeToRemove.Length > 0).ToList()
            .ForEach(tag =>
            {
                html = ha.RemoveUnwantedHtmlAttributes(html, encode, tag.Tag, tag.AttributeToRemove.ToList());
            });

            tags.Where(t => t.RemoveAllTag == false && t.StyleToRemove != null && t.StyleToRemove.Length > 0).ToList()
            .ForEach(tag =>
            {
                html = ha.RemoveUnwantedHtmlStyle(html, encode, tag.Tag, tag.StyleToRemove.ToList());
            });

            return(html);
        }
Esempio n. 2
0
        public static string ConsolidateRepeatedTags(string html, string encode, string Tag = "span")
        {
            var ha = new HTMLAgility();

            return(ha.ConsolidateRepeatedTags(html, encode, Tag));
        }
Esempio n. 3
0
        public static List <KeyValuePair <string, string> > GetTagContent(string html, string encode, string Tag)
        {
            var ha = new HTMLAgility();

            return(ha.GetTagContent(html, encode, Tag));
        }