Пример #1
0
        public static HtmlDocument EmptyHtmlDocument(this IAn an)
        {
            var assemblyPath = an.AssemblyPath();
            var documentPath = Path.Combine(assemblyPath, "empty.html");
            var document     = new HtmlDocument();

            using (var stream = File.OpenRead(documentPath))
            {
                document.Load(stream);
            }

            return(document);
        }
Пример #2
0
        public static HtmlNodeCollection TableRows(this IAn an)
        {
            var doc          = new HtmlDocument();
            var assemblyPath = an.AssemblyPath();
            var path         = Path.Combine(assemblyPath, "Parser", "table-rows.xml");

            using (var file = File.OpenRead(path))
                using (var fileReader = new StreamReader(file))
                {
                    var line = string.Empty;
                    while ((line = fileReader.ReadLine()) != null)
                    {
                        var row = HtmlNode.CreateNode(line);
                        doc.DocumentNode.AppendChild(row);
                    }
                }
            return(doc.DocumentNode.ChildNodes);
        }