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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? filtertest.java

?? html解析包 可以很方便的解析html 純java 實現
?? JAVA
字號:
// HTMLParser Library $Name: v1_6_20051112 $ - 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);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品日韩综合观看成人91| 亚洲成人7777| 亚洲一区二区三区精品在线| 久久精品国产精品亚洲红杏| 99精品在线免费| 精品久久国产老人久久综合| 亚洲卡通欧美制服中文| 国产黑丝在线一区二区三区| 精品视频1区2区| 亚洲欧美日韩一区| 高清国产一区二区三区| 欧美成人艳星乳罩| 婷婷开心久久网| 欧美制服丝袜第一页| 国产精品女人毛片| 韩国成人福利片在线播放| 69精品人人人人| 一区二区欧美在线观看| 96av麻豆蜜桃一区二区| 国产精品热久久久久夜色精品三区| 久久97超碰国产精品超碰| 欧美精选在线播放| 亚洲电影在线播放| 在线观看91视频| 亚洲综合区在线| 在线观看成人免费视频| 一区二区三区在线影院| 色狠狠av一区二区三区| 亚洲女同女同女同女同女同69| 成人精品电影在线观看| 中文字幕av不卡| 播五月开心婷婷综合| 18成人在线观看| 99视频一区二区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 成人午夜看片网址| 中文字幕一区二区视频| 99久久99久久久精品齐齐| 亚洲精品免费看| 欧美色图免费看| 日韩精品欧美成人高清一区二区| 6080亚洲精品一区二区| 久久激五月天综合精品| 久久婷婷国产综合国色天香 | 亚洲精品在线观看网站| 老司机精品视频导航| 精品国产露脸精彩对白| 国产一区不卡在线| 国产精品国产三级国产aⅴ原创| 成人av手机在线观看| 亚洲黄色免费电影| 7777女厕盗摄久久久| 激情另类小说区图片区视频区| 精品久久免费看| av在线播放一区二区三区| 亚洲精品免费电影| 91精品国产一区二区| 国产成人av一区二区三区在线 | 日韩免费观看2025年上映的电影| 日本欧美加勒比视频| 久久这里只有精品首页| 99精品黄色片免费大全| 日日欢夜夜爽一区| 久久精品欧美日韩| 欧美日韩专区在线| 韩国女主播成人在线| 亚洲男同1069视频| 日韩久久久久久| 91老司机福利 在线| 日韩在线一区二区| 国产精品福利电影一区二区三区四区 | 久久综合色婷婷| 一本一道久久a久久精品| 日韩av在线播放中文字幕| 国产午夜精品一区二区| 欧美日韩aaa| 国产91高潮流白浆在线麻豆 | 中文乱码免费一区二区| 欧美日韩视频专区在线播放| 国产激情偷乱视频一区二区三区| 夜夜精品浪潮av一区二区三区| 久久免费电影网| 欧美精品高清视频| 成人午夜av电影| 久久精品国产999大香线蕉| 亚洲最快最全在线视频| 国产亚洲成年网址在线观看| 欧美高清激情brazzers| 99久久免费视频.com| 国模冰冰炮一区二区| 午夜一区二区三区视频| 最新日韩av在线| 久久精品日产第一区二区三区高清版| 在线不卡欧美精品一区二区三区| 成人av网址在线观看| 国产综合色视频| 日本中文字幕一区二区有限公司| 亚洲综合免费观看高清在线观看| 国产精品久久久久久久久免费樱桃| 日韩欧美一区二区在线视频| 欧美日韩在线播| 91国偷自产一区二区开放时间 | 在线精品视频小说1| 成人黄页在线观看| 国产成人午夜精品5599| 国内精品免费在线观看| 精品亚洲成a人在线观看| 青草国产精品久久久久久| 丝袜亚洲另类欧美| 午夜欧美一区二区三区在线播放| 一区二区视频在线看| 一区二区三区日韩在线观看| 综合中文字幕亚洲| 亚洲视频网在线直播| 亚洲欧美福利一区二区| 亚洲欧洲综合另类在线| 一区二区视频在线| 亚洲v日本v欧美v久久精品| 午夜精品一区二区三区电影天堂 | 777午夜精品免费视频| 欧美男生操女生| 91精品国产综合久久福利软件| 欧美精品久久99| 欧美成人激情免费网| 日韩美女在线视频| 国产亚洲精品超碰| 中文字幕日韩一区| 亚洲一区av在线| 午夜欧美电影在线观看| av电影一区二区| 色偷偷88欧美精品久久久| 欧美丝袜丝nylons| 欧美一二三区在线观看| 久久这里只有精品首页| 亚洲欧美在线高清| 亚洲国产精品麻豆| 老司机免费视频一区二区| 高清国产一区二区| 色婷婷av一区二区| 日韩一区二区三区高清免费看看| 国产午夜精品在线观看| 亚洲精品高清在线观看| 免费高清在线一区| 成人亚洲一区二区一| 欧美性受极品xxxx喷水| 精品精品国产高清a毛片牛牛| 国产精品久久毛片av大全日韩| 亚洲第一成人在线| 国产老女人精品毛片久久| 色素色在线综合| 欧美tickling挠脚心丨vk| 亚洲欧美综合另类在线卡通| 丝袜美腿高跟呻吟高潮一区| 国产suv精品一区二区883| 色婷婷av一区二区三区软件| 日韩你懂的电影在线观看| 亚洲欧美aⅴ...| 麻豆高清免费国产一区| 91同城在线观看| 欧美一区二区三区免费在线看 | 一区二区三区日韩精品| 另类小说图片综合网| 国产91清纯白嫩初高中在线观看| 欧美在线一二三四区| 久久你懂得1024| 午夜精品一区在线观看| 99久久精品国产一区二区三区| 欧美精品自拍偷拍| 国产精品拍天天在线| 美腿丝袜亚洲一区| 欧美视频完全免费看| 中文子幕无线码一区tr| 美国一区二区三区在线播放| 精品成人一区二区| 天堂成人国产精品一区| 99精品久久只有精品| 国产亚洲一区字幕| 久久狠狠亚洲综合| 欧美剧情片在线观看| 一区二区三区四区五区视频在线观看| 国产伦精品一区二区三区免费| 精品视频在线看| 亚洲视频狠狠干| 成人午夜精品一区二区三区| www久久精品| 免费一级片91| 欧美一区二视频| 日韩综合小视频| 欧美日韩综合在线免费观看| 亚洲精品v日韩精品| 93久久精品日日躁夜夜躁欧美| 中文字幕精品综合| 福利电影一区二区| 国产日韩精品一区二区浪潮av| 免费成人性网站| 欧美不卡激情三级在线观看| 日韩国产精品91| 欧美一区二区黄| 麻豆精品一区二区av白丝在线| 91麻豆精品91久久久久久清纯 |