コード例 #1
0
        public static void LoadHtmlFile(
            System.IO.TextReader reader,
            DomDocument document,
            string baseUrl)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }
            HTMLDocument htmlDoc = new HTMLDocument();
            string       html    = reader.ReadToEnd();

            htmlDoc.LoadHTML(html);
            if (string.IsNullOrEmpty(baseUrl) == false)
            {
                htmlDoc.BaseURL = baseUrl;
            }
            HtmlLoader loader = new HtmlLoader();

            loader.Load(htmlDoc, document);
            document.AfterLoad(FileFormat.Html);
        }