public static string ToHtml(this IHtmlNode element) { using (var html = new StringWriter()) { element.Render(html); return(html.ToString()); } }
private void RenderHtml(TextWriter writer, IHtmlNode html) { if (html.PrevSibings.Any()) { html.PrevSibings.Each(delegate(IHtmlNode item) { item.Render(writer); }); } html.Render(writer); if (html.NextSibings.Any()) { html.NextSibings.Each(delegate(IHtmlNode item) { item.Render(writer); }); } }
public static void Render(this IHtmlNode element, TextWriter html) { var visitor = new DefaultHtmlVisitor(html); element.Render(visitor); }