Package org.htmlparser.filters

Examples of org.htmlparser.filters.StringFilter


     */
    public StringFilterWrapper ()
    {
        Thread thread;

        mFilter = new StringFilter ();
        mFilter.setCaseSensitive (true);

        // add the text pattern
        mPattern = new JTextArea (2, 20);
        mPattern.setBorder (new BevelBorder (BevelBorder.LOWERED));
View Full Code Here


     * Get the underlying node filter object.
     * @return The node filter object suitable for serialization.
     */
    public NodeFilter getNodeFilter ()
    {
        StringFilter ret;
       
        ret = new StringFilter ();
        ret.setCaseSensitive (mFilter.getCaseSensitive ());
        ret.setLocale (mFilter .getLocale ());
        ret.setPattern (mFilter.getPattern ());
           
        return (ret);
    }
View Full Code Here

        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 ());
    }
View Full Code Here

        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"));
View Full Code Here

        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"));
View Full Code Here

            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"));
View Full Code Here

TOP

Related Classes of org.htmlparser.filters.StringFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.