public static string Filter(string html, HtmlProfile profile)
        {
            if (string.IsNullOrWhiteSpace(html))
            {
                return(string.Empty);
            }

            using (var htmlReader = new HtmlReader(html))
            {
                using (var stringWriter = new StringWriter())
                {
                    using (var xmlWriter = XmlWriter.Create(stringWriter, DefaultXmlWriterSettings))
                    {
                        Filter(htmlReader, xmlWriter, profile);
                    }

                    return(stringWriter.ToString());
                }
            }
        }
示例#2
0
        public static string Filter(string html, HtmlProfile profile)
        {
            if (string.IsNullOrWhiteSpace(html))
            {
                return string.Empty;
            }

            using (var htmlReader = new HtmlReader(html))
            {
                using (var stringWriter = new StringWriter())
                {
                    using (var xmlWriter = XmlWriter.Create(stringWriter, DefaultXmlWriterSettings))
                    {
                        Filter(htmlReader, xmlWriter, profile);
                    }

                    return stringWriter.ToString();
                }
            }
        }