Package org.htmlparser.filters

Examples of org.htmlparser.filters.AndFilter


    /**
     * Create a wrapper over a new AndFilter.
     */
    public AndFilterWrapper ()
    {
        mFilter = new AndFilter ();

        // add the subfilter container
        mContainer = new SubFilterList (this, "Predicates", 0);
        add (mContainer);
    }
View Full Code Here


     */
    public NodeFilter getNodeFilter ()
    {
        NodeFilter[] predicates;
        NodeFilter[] temp;
        AndFilter ret;
       
        ret = new AndFilter ();

        predicates = mFilter.getPredicates ();
        temp = new NodeFilter[predicates.length];
        for (int i = 0; i < predicates.length; i++)
            temp[i] = ((Filter)predicates[i]).getNodeFilter ();
        ret.setPredicates (temp);
           
        return (ret);
    }
View Full Code Here

            // handle robots meta tag according to http://www.robotstxt.org/wc/meta-user.html
            // <meta name="robots" content="index,follow" />
            // <meta name="robots" content="noindex,nofollow" />
            robots = list.extractAllNodesThatMatch (
                new AndFilter (
                    new NodeClassFilter (MetaTag.class),
                    new HasAttributeFilter ("name", "robots")), true);
            if (0 != robots.size ())
            {
                robot = (MetaTag)robots.elementAt (0);
View Full Code Here

        }
        else
            url = args[0];
        filter = new NodeClassFilter (LinkTag.class);
        if ((1 < args.length) && args[1].equalsIgnoreCase ("-maillinks"))
            filter = new AndFilter (
                filter,
                new NodeFilter ()
                {
                    public boolean accept (Node node)
                    {
View Full Code Here

        if (null != kids)
        {
            cls = new NodeClassFilter (TableRow.class);
            recursion = new HasParentFilter (null);
            filter = new OrFilter (
                        new AndFilter (
                            cls,
                            new IsEqualFilter (this)),
                        new AndFilter ( // recurse up the parent chain
                            new NotFilter (cls), // but not past the first row
                            recursion));
            recursion.setParentFilter (filter);
            kids = kids.extractAllNodesThatMatch (
                // it's a column, and has this row as it's enclosing row
                new AndFilter (
                    new NodeClassFilter (TableColumn.class),
                    filter), true);
            ret = new TableColumn[kids.size ()];
            kids.copyToNodeArray (ret);
        }
View Full Code Here

        if (null != kids)
        {
            cls = new NodeClassFilter (TableRow.class);
            recursion = new HasParentFilter (null);
            filter = new OrFilter (
                        new AndFilter (
                            cls,
                            new IsEqualFilter (this)),
                        new AndFilter ( // recurse up the parent chain
                            new NotFilter (cls), // but not past the first row
                            recursion));
            recursion.setParentFilter (filter);
            kids = kids.extractAllNodesThatMatch (
                // it's a header, and has this row as it's enclosing row
                new AndFilter (
                    new NodeClassFilter (TableHeader.class),
                    filter), true);
            ret = new TableHeader[kids.size ()];
            kids.copyToNodeArray (ret);
        }
View Full Code Here

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

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

        if (null != kids)
        {
            cls = new NodeClassFilter (TableTag.class);
            recursion = new HasParentFilter (null);
            filter = new OrFilter (
                        new AndFilter (
                            cls,
                            new IsEqualFilter (this)),
                        new AndFilter ( // recurse up the parent chain
                            new NotFilter (cls), // but not past the first table
                            recursion));
            recursion.setParentFilter (filter);
            kids = kids.extractAllNodesThatMatch (
                // it's a row, and has this table as it's enclosing table
                new AndFilter (
                    new NodeClassFilter (TableRow.class),
                    filter), true);
            ret = new TableRow[kids.size ()];
            kids.copyToNodeArray (ret);
        }
View Full Code Here

    return lines.length;
  }

  public int countOfTagWithIdPrefix(String tag, String idPrefix) throws Exception {
    NodeFilter filter =
      new AndFilter(
        new TagNameFilter(tag),
        new HasAttributePrefixFilter("id", idPrefix));
    return getMatchingTags(filter).size();
  }
View Full Code Here

TOP

Related Classes of org.htmlparser.filters.AndFilter

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.