示例#1
0
        public void TestFindElement()
        {
            FileStream file   = new FileStream("Data/simple.htm", FileMode.Open);
            var        doc    = new HtmlDoc(file).RootElement;
            var        tables = from table in doc.FindElements("table")
                                where table.Attributes["width"] == "98%"
                                where table.Attributes["cellpadding"] == "7"
                                select table;

            Assert.AreEqual(1, tables.Count());

            tables = from table in doc.FindElements()
                     where table.Name == "table"
                     select table;

            Assert.AreEqual(3, tables.Count());
        }
示例#2
0
        public void TestFindElement()
        {
            FileStream file = new FileStream("Data/simple.htm", FileMode.Open);
            var doc = new HtmlDoc(file).RootElement;
            var tables = from table in doc.FindElements("table")
                        where table.Attributes["width"] == "98%"
                        where table.Attributes["cellpadding"] == "7"
                        select table;

            Assert.AreEqual(1, tables.Count());

            tables = from table in doc.FindElements()
                    where table.Name == "table"
                    select table;
            Assert.AreEqual(3, tables.Count());
        }