public static void LoadHtmlFragment(XNode node, TextReader reader, ParserOptions options) { XDomBuilder dom = new XDomBuilder(node); HtmlStreamParser <XNode> parser = new HtmlStreamParser <XNode>(); HtmlTextReader htmlTextReader = new HtmlTextReader(reader); parser.Parse(dom, htmlTextReader, options, InsersionMode.InBody); }
internal static void LoadHtml(XDocument doc, TextReader reader, ParserOptions options) { XDomBuilder dom = new XDomBuilder(doc); HtmlStreamParser <XNode> parser = new HtmlStreamParser <XNode>(); HtmlTextReader htmlTextReader = new HtmlTextReader(reader); parser.Parse(dom, htmlTextReader, options); }
internal static async Task LoadWebPageAsync(XDocument doc, string url, LoaderOptions options) { LoaderOptions optionsToUse = options == null ? new LoaderOptions() : options; optionsToUse.ParserOptions.BaseUrl = string.IsNullOrEmpty(optionsToUse.ParserOptions.BaseUrl) ? url : optionsToUse.ParserOptions.BaseUrl; // Get the Html asynchronously and Parse it into an Xml Document using (HtmlTextReader htmlReader = await HtmlClient.GetHtmlTextReaderAsync(url, optionsToUse)) { XDomBuilder dom = new XDomBuilder(doc); HtmlStreamParser <XNode> parser = new HtmlStreamParser <XNode>(); parser.Parse(dom, htmlReader, optionsToUse.ParserOptions); } }