Exemplo n.º 1
0
        private void Parse(string html)
        {
            Inlines.Clear();
            if (html == null)
            {
                return;
            }
            HtmlTagTree tree   = new HtmlTagTree();
            HtmlParser  parser = new HtmlParser(tree);   //output

            parser.Parse(new StringReader(html));        //input

            HtmlUpdater updater = new HtmlUpdater(this); //output

            updater.Update(tree);
        }
Exemplo n.º 2
0
        private void Parse(string html)
        {
            if (!String.IsNullOrEmpty(Highlight))
            {
                int idx = html.IndexOf(Highlight, StringComparison.InvariantCultureIgnoreCase);
                while (idx != -1)
                {
                    html = String.Format("{0}[b]{1}[/b]{2}",
                                         html.Substring(0, idx), html.Substring(idx, Highlight.Length), html.Substring(idx + Highlight.Length));
                    idx = html.IndexOf(Highlight, idx + 7 + Highlight.Length, StringComparison.InvariantCultureIgnoreCase);
                }
            }

            Inlines.Clear();
            HtmlTagTree tree   = new HtmlTagTree();
            HtmlParser  parser = new HtmlParser(tree);   //output

            parser.Parse(new StringReader(html));        //input

            HtmlUpdater updater = new HtmlUpdater(this); //output

            updater.Update(tree);
        }