public static string Rewrite(string html, Uri baseuri)
        {
            HtmlReader              r  = new HtmlReader(html);
            StringWriter            sw = new StringWriter();
            HtmlAbsoluteLinksWriter w  = new HtmlAbsoluteLinksWriter(sw);

            w.BaseHref = baseuri;
            while (!r.EOF)
            {
                w.WriteNode(r, true);
            }
            w.Close();
            return(sw.ToString());
        }
Exemple #2
0
 public static string CleanHtml(string html, Html.HtmlWriterOptions options)
 {
     try
     {
         Html.HtmlReader r  = new Html.HtmlReader(html);
         StringWriter    sw = new StringWriter();
         Html.HtmlWriter w  = new Html.HtmlWriter(sw, options);
         while (!r.EOF)
         {
             w.WriteNode(r, true);
         }
         w.Close();
         return(sw.ToString());
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Exemple #3
0
 public static string CleanHtml(string html, Html.HtmlWriterOptions options)
 {
     try
     {
         Html.HtmlReader r = new Html.HtmlReader(html);
         StringWriter sw = new StringWriter();
         Html.HtmlWriter w = new Html.HtmlWriter(sw, options);
         while (!r.EOF)
         {
             w.WriteNode(r, true);
         }
         w.Close();
         return sw.ToString();
     }
     catch (Exception e)
     {
         return e.Message;
     }
 }
 public static string Rewrite(string html, Uri baseuri)
 {
     HtmlReader r = new HtmlReader(html);
     StringWriter sw = new StringWriter();
     HtmlAbsoluteLinksWriter w = new HtmlAbsoluteLinksWriter(sw);
     w.BaseHref = baseuri;
     while (!r.EOF)
     {
         w.WriteNode(r, true);
     }
     w.Close();
     return sw.ToString();
 }