亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? filtertest.java

?? 本程序用于對(duì)頁面信息進(jìn)行提取并分析
?? JAVA
字號(hào):
// HTMLParser Library $Name: v1_6_20060319 $ - A java-based parser for HTML// http://sourceforge.org/projects/htmlparser// Copyright (C) 2003 Derrick Oswald//// Revision Control Information//// $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/filterTests/FilterTest.java,v $// $Author: derrickoswald $// $Date: 2004/07/02 00:49:29 $// $Revision: 1.7 $//// This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.//// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//package org.htmlparser.tests.filterTests;import org.htmlparser.Parser;import org.htmlparser.Tag;import org.htmlparser.filters.AndFilter;import org.htmlparser.filters.CssSelectorNodeFilter;import org.htmlparser.filters.HasAttributeFilter;import org.htmlparser.filters.HasChildFilter;import org.htmlparser.filters.NodeClassFilter;import org.htmlparser.filters.NotFilter;import org.htmlparser.filters.OrFilter;import org.htmlparser.filters.RegexFilter;import org.htmlparser.filters.StringFilter;import org.htmlparser.filters.TagNameFilter;import org.htmlparser.lexer.Lexer;import org.htmlparser.Text;import org.htmlparser.tags.BodyTag;import org.htmlparser.tags.LinkTag;import org.htmlparser.tests.ParserTestCase;import org.htmlparser.util.NodeIterator;import org.htmlparser.util.NodeList;import org.htmlparser.util.ParserException;/** * Test the operation of filters. */public class FilterTest extends ParserTestCase{    static    {        System.setProperty ("org.htmlparser.tests.filterTests.FilterTest", "FilterTest");    }    public FilterTest (String name)    {        super (name);    }    /**     * Test node class filtering.     */    public void testNodeClass () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<body>Now is the time for all good men..</body>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (new NodeClassFilter (BodyTag.class));        assertEquals ("only one element", 1, list.size ());        assertType ("should be BodyTag", BodyTag.class, list.elementAt (0));        BodyTag body = (BodyTag)list.elementAt (0);        assertEquals ("only one child", 1, body.getChildCount ());        assertSuperType ("should be Text", Text.class, body.getChildren ().elementAt (0));        assertStringEquals("html", guts, body.toHtml ());    }    /**     * Test tag name filtering.     */    public void testTagName () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<booty>Now is the time for all good men..</booty>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (new TagNameFilter ("booty"));        assertEquals ("only one element", 1, list.size ());        assertSuperType ("should be Tag", Tag.class, list.elementAt (0));        assertStringEquals("name", "BOOTY", ((Tag)(list.elementAt (0))).getTagName ());    }    /**     * Test string filtering.     */    public void testString () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<body>Now is the <a id=target><b>time</b></a> for all good <time>men</time>..</body>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (new StringFilter ("Time"));        assertEquals ("only one element", 1, list.size ());        assertSuperType ("should be String", Text.class, list.elementAt (0));        assertStringEquals("name", "time", ((Text)list.elementAt (0)).getText ());        // test case sensitivity        list = parser.extractAllNodesThatMatch (new StringFilter ("Time", true));        assertEquals ("should be no elements", 0, list.size ());    }    /**     * Test child filtering.     */    public void testChild () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<body>Now is the <a id=target><b>time</b></a> for all good <a href=http://bongo.com>men</a>..</body>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (new HasChildFilter (new TagNameFilter ("b")));        assertEquals ("only one element", 1, list.size ());        assertType ("should be LinkTag", LinkTag.class, list.elementAt (0));        LinkTag link = (LinkTag)list.elementAt (0);        assertEquals ("three children", 3, link.getChildCount ());        assertSuperType ("should be TagNode", Tag.class, link.getChildren ().elementAt (0));        Tag tag = (Tag)link.getChildren ().elementAt (0);        assertStringEquals("name", "B", tag.getTagName ());    }    /**     * Test attribute filtering.     */    public void testAttribute () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<body>Now is the <a id=target><b>time</b></a> for all good <a href=http://bongo.com>men</a>..</body>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (new HasAttributeFilter ("id"));        assertEquals ("only one element", 1, list.size ());        assertType ("should be LinkTag", LinkTag.class, list.elementAt (0));        LinkTag link = (LinkTag)list.elementAt (0);        assertEquals ("attribute value", "target", link.getAttribute ("id"));    }    /**     * Test and filtering.     */    public void testAnd () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<body>Now is the <a id=one><b>time</b></a> for all good <a id=two><b>men</b></a>..</body>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (            new AndFilter (                new HasChildFilter (                    new TagNameFilter ("b")),                new HasChildFilter (                    new StringFilter ("men")))                );        assertEquals ("only one element", 1, list.size ());        assertType ("should be LinkTag", LinkTag.class, list.elementAt (0));        LinkTag link = (LinkTag)list.elementAt (0);        assertEquals ("attribute value", "two", link.getAttribute ("id"));    }    /**     * Test or filtering.     */    public void testOr () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<body>Now is the <a id=one><b>time</b></a> for <a id=two><b>all</b></a> good <a id=three><b>men</b></a>..</body>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (            new OrFilter (                new HasChildFilter (                    new StringFilter ("time")),                new HasChildFilter (                    new StringFilter ("men")))                );        assertEquals ("two elements", 2, list.size ());        assertType ("should be LinkTag", LinkTag.class, list.elementAt (0));        LinkTag link = (LinkTag)list.elementAt (0);        assertEquals ("attribute value", "one", link.getAttribute ("id"));        assertType ("should be LinkTag", LinkTag.class, list.elementAt (1));        link = (LinkTag)list.elementAt (1);        assertEquals ("attribute value", "three", link.getAttribute ("id"));    }    /**     * Test not filtering.     */    public void testNot () throws ParserException    {        String guts;        String html;        NodeList list;        guts = "<body>Now is the <a id=one><b>time</b></a> for <a id=two><b>all</b></a> good <a id=three><b>men</b></a>..</body>";        html = "<html>" + guts + "</html>";        createParser (html);        list = parser.extractAllNodesThatMatch (            new AndFilter (                new HasChildFilter (                    new TagNameFilter ("b")),                new NotFilter (                    new HasChildFilter (                        new StringFilter ("all"))))                );        assertEquals ("two elements", 2, list.size ());        assertType ("should be LinkTag", LinkTag.class, list.elementAt (0));        LinkTag link = (LinkTag)list.elementAt (0);        assertEquals ("attribute value", "one", link.getAttribute ("id"));        assertType ("should be LinkTag", LinkTag.class, list.elementAt (1));        link = (LinkTag)list.elementAt (1);        assertEquals ("attribute value", "three", link.getAttribute ("id"));    }    public void testEscape() throws Exception    {        assertEquals ("douchebag", CssSelectorNodeFilter.unescape ("doucheba\\g").toString ());    }    public void testSelectors() throws Exception    {        String html = "<html><head><title>sample title</title></head><body inserterr=\"true\" yomama=\"false\"><h3 id=\"heading\">big </invalid>heading</h3><ul id=\"things\"><li><br word=\"broken\"/>&gt;moocow<li><applet/>doohickey<li class=\"last\"><b class=\"item\">final<br>item</b></ul></body></html>";        Lexer l;        Parser p;        CssSelectorNodeFilter it;        NodeIterator i;        int count;        l = new Lexer (html);        p = new Parser (l);        it = new CssSelectorNodeFilter ("li + li");        count = 0;        for (i = p.extractAllNodesThatMatch (it).elements (); i.hasMoreNodes ();)        {            assertEquals ("tag name wrong", "LI", ((Tag)i.nextNode()).getTagName());            count++;        }        assertEquals ("wrong count", 2, count);    }    /**     * Test regular expression matching:     */    public void testRegularExpression () throws Exception    {        String target =              "\n"            + "\n"            + "Most recently, in the Western Conference final, the Flames knocked off \n"            + "the San Jose Sharks, the Pacific Division champions, to become the first \n"            + "Canadian team to reach the Stanley Cup Championship series since 1994.";                    String html =              "<html><head><title>CBC Sports Online: NHL Playoffs</title></head>"            + "<body><h1>CBC SPORTS ONLINE</h1>\n"            + "The Calgary Flames have already defeated three NHL division winners \n"            + "during their improbable playoff run. If they are to hoist the Stanley \n"            + "Cup they'll have to go through one more. <p><table ALIGN=\"Right\" width=196 CELLPADDING=0 cellspacing=0 hspace=4> <tr><td><img src=\"/gfx/topstory/sports/iginla_j0524.jpg\" width=194 height=194 hspace=3 border=1><br>\n"            + "\n"            + "<font SIZE=\"1\" FACE=\"verdana,arial\">\n"            + "Jarome Iginla skates during the Flames' practice on Monday. Calgary takes on the Tampa Bay Lightning in the Stanley Cup finals beginning Tuesday night in Tampa\n"            + "</font></td></tr></table>\n"            + "\n"            + "\n"            + "In the post-season's first round, the Flames defeated the Vancouver \n"            + "Canucks, the Northwest Division winners, in seven tough games. <p>\n"            + "\n"            + "In Round 2 it was the Detroit Red Wings, who not only won the Central \n"            + "Division, but also boasted the NHL's best overall record during the \n"            + "regular season, who fell to the Flames. <p>"            + target            + "<p>\n"            + "\n"            + "Up next for the Flames is the Tampa Bay Lighting -- the runaway winners \n"            + "of the NHL's Southeast Division and the Eastern Conference's best team \n"            + "during the regular season. <p>\n"            + "\n"            + "The Lighting advanced by beating the Philadelphia Flyers in the Eastern \n"            + "Conference final. <p>\n"            + "</body></html>\n";        Lexer lexer;        Parser parser;        RegexFilter filter;        NodeIterator iterator;        int count;        lexer = new Lexer (html);        parser = new Parser (lexer);        filter = new RegexFilter ("(19|20)\\d\\d([- \\\\/.](0[1-9]|1[012])[- \\\\/.](0[1-9]|[12][0-9]|3[01]))?");        count = 0;        for (iterator = parser.extractAllNodesThatMatch (filter).elements (); iterator.hasMoreNodes ();)        {            assertEquals ("text wrong", target, iterator.nextNode ().toHtml ());            count++;        }        assertEquals ("wrong count", 1, count);    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老司机免费视频一区二区三区| 精品一区二区三区欧美| 中文字幕一区二区三区四区| 久久久精品黄色| 久久精品在这里| 国产欧美一区二区精品性色 | 日本精品视频一区二区三区| av爱爱亚洲一区| 色综合色狠狠综合色| 色狠狠一区二区| 欧美久久久一区| 欧美一区二区视频在线观看2022 | 久久精品亚洲麻豆av一区二区 | 视频一区欧美精品| 男男gaygay亚洲| 韩国成人精品a∨在线观看| 久久综合久久综合久久| 精品国产一区二区精华| 精品久久国产字幕高潮| 国产三级精品三级| 一区在线观看视频| 亚洲卡通欧美制服中文| 亚洲成精国产精品女| 喷水一区二区三区| 国产精品系列在线观看| 91亚洲精品一区二区乱码| 在线观看成人小视频| 51精品国自产在线| 久久精品这里都是精品| 亚洲人成电影网站色mp4| 五月综合激情婷婷六月色窝| 精品午夜久久福利影院| 99精品在线观看视频| 欧美日韩一区二区三区四区 | 国产精品美女久久福利网站 | 床上的激情91.| 在线日韩av片| 久久综合国产精品| 亚洲欧美另类小说| 日韩电影免费一区| 粉嫩av一区二区三区| 精品视频免费看| 久久女同精品一区二区| 亚洲一区二区三区在线| 国内不卡的二区三区中文字幕| 97久久精品人人做人人爽| 9191久久久久久久久久久| 久久精品一区蜜桃臀影院| 亚洲午夜国产一区99re久久| 激情综合网最新| 91激情在线视频| 久久天堂av综合合色蜜桃网| 一区二区在线观看视频在线观看| 久久国产精品无码网站| 在线视频一区二区三区| 国产亚洲美州欧州综合国 | 欧美亚洲一区二区在线| 久久久久久久一区| 视频在线观看91| a在线播放不卡| 精品国一区二区三区| 一区二区三区中文在线观看| 国产精品77777| 欧美一区二区三区四区高清| 一区二区三区免费网站| 国产成人av自拍| 欧美成人艳星乳罩| 亚洲午夜一二三区视频| 成人网在线免费视频| 久久综合色播五月| 日本成人在线视频网站| 日本精品裸体写真集在线观看| 久久久久国产一区二区三区四区| 日精品一区二区三区| 欧洲日韩一区二区三区| 中文字幕一区二区视频| 成人性色生活片| 久久久久久久av麻豆果冻| 蜜芽一区二区三区| 欧美情侣在线播放| 亚洲国产人成综合网站| 色婷婷av一区二区| 亚洲人成网站精品片在线观看| 成人污视频在线观看| 国产欧美日本一区二区三区| 久久av中文字幕片| 91精品国产欧美一区二区18 | 色乱码一区二区三区88 | 成人精品鲁一区一区二区| 久久综合网色—综合色88| 精品一区二区三区在线视频| 91精品国产综合久久国产大片| 曰韩精品一区二区| 91麻豆6部合集magnet| 综合欧美亚洲日本| 北条麻妃一区二区三区| 国产精品污污网站在线观看| 国产99久久久精品| 中文字幕国产一区二区| 成人av网址在线| 国产精品免费aⅴ片在线观看| 丁香啪啪综合成人亚洲小说| 欧美经典一区二区三区| 福利一区福利二区| 国产精品美女久久福利网站| 国产成人综合视频| 中文字幕乱码一区二区免费| av电影在线观看一区| 中文字幕一区二区三区不卡| 99精品国产99久久久久久白柏| 最新欧美精品一区二区三区| 色拍拍在线精品视频8848| 亚洲香肠在线观看| 欧美一级日韩一级| 久久99精品久久久| 国产日韩欧美一区二区三区综合| 国产精品一区二区黑丝| 国产精品女同互慰在线看| 色婷婷久久久久swag精品| 午夜精品一区二区三区三上悠亚| 91精品久久久久久久91蜜桃| 国产在线精品一区二区| 日本一区二区三区dvd视频在线| 97精品久久久久中文字幕| 亚洲一区在线视频观看| 日韩欧美亚洲国产精品字幕久久久| 久久成人久久爱| 日本一区免费视频| 欧美少妇一区二区| 久久99精品久久久久婷婷| 国产精品色在线| 欧美性猛片xxxx免费看久爱| 日本不卡中文字幕| 国产欧美日韩精品在线| 在线观看视频91| 久久99在线观看| 国产精品久久久久久久久免费丝袜 | 国产sm精品调教视频网站| 亚洲欧洲中文日韩久久av乱码| 91精品国产色综合久久不卡电影| 国产精品影音先锋| 亚洲国产aⅴ天堂久久| 精品国产伦一区二区三区免费| 99久久精品99国产精品| 性做久久久久久久久| 久久久精品免费观看| 欧美丝袜自拍制服另类| 韩国av一区二区三区| 亚洲视频一区二区免费在线观看| 777久久久精品| heyzo一本久久综合| 日本亚洲天堂网| 亚洲在线中文字幕| 奇米色一区二区三区四区| 国产人成一区二区三区影院| 91官网在线免费观看| 国产伦精一区二区三区| 一区二区三区在线不卡| www成人在线观看| 欧美三级乱人伦电影| 福利一区二区在线| 蜜臀av一区二区在线观看| 亚洲人被黑人高潮完整版| 久久亚洲一级片| 91麻豆精品91久久久久同性| av一区二区不卡| 国产精品888| 久久国产综合精品| 亚洲成a人v欧美综合天堂| 国产精品久久看| 久久久综合网站| 欧美一区二区日韩| 在线看日本不卡| 成年人午夜久久久| 国内精品久久久久影院色| 首页国产欧美久久| 亚洲一线二线三线视频| 日韩毛片在线免费观看| 国产欧美一区二区在线观看| 日韩精品综合一本久道在线视频| 欧洲人成人精品| 一本色道综合亚洲| hitomi一区二区三区精品| 国产福利一区二区| 狠狠色丁香久久婷婷综| 久久精品国产一区二区三 | 在线国产电影不卡| 懂色一区二区三区免费观看| 日本vs亚洲vs韩国一区三区 | 欧美三区在线观看| 91免费观看国产| 成人网在线播放| 国产91精品在线观看| 国产一区二区导航在线播放| 蜜桃av一区二区在线观看| 日韩av二区在线播放| 亚洲mv在线观看| 香蕉久久夜色精品国产使用方法 | 一区二区三区四区视频精品免费 | 欧美日韩精品一区二区三区四区|