Package org.htmlparser.filters

Examples of org.htmlparser.filters.HasAttributeFilter


       
      try {
        parser.setURL(BROWSE_CATEGORIES_URL);
 
        NodeFilter categoryFilter = new AndFilter(
            new HasAncestorFilter(new HasAttributeFilter("id", "genres")),
            new NodeClassFilter(LinkTag.class)
        );
 
        NodeList categoryNodes = parser.extractAllNodesThatMatch(categoryFilter);
 
View Full Code Here


     
      parser.setURL(QUEUE_URL);

      NodeFilter queueFilter = new OrFilter(
        new CssClassFilter("dvd-out"),
        new HasAttributeFilter("id", "dvd-queue")
      );

      NodeList queueNodes = parser.extractAllNodesThatMatch(queueFilter);

            int size = queueNodes.size();
View Full Code Here

      parser.setURL(url);

      NodeFilter discFilter = new AndFilter(
        new CssClassFilter("disc"),
        new HasChildFilter(new HasChildFilter(
            new HasAttributeFilter("href", "/catalog/movieDetails/" + item.getMovieId())))
      );
     
      NodeFilter removeFilter = new AndFilter(
          new NodeClassFilter(LinkTag.class),
          new CssClassFilter("bvr-qremove")
View Full Code Here

        checkLogin();
    try {
      parser.setURL(QUEUE_URL);

            NodeCollector infoCollector = new NodeCollector(new NodeFilter[] {
                    new HasAttributeFilter("id", "queueShippedList"),
                    new HasAttributeFilter("id", "queueCurrentList")
            });

      parser.extractAllNodesThatMatch(infoCollector);

            int i=0;
View Full Code Here

            }
            parser.setURL(url);

            NodeCollector infoCollector = new NodeCollector(new NodeFilter[] {
                    new AndFilter(
                            new HasParentFilter(new HasAttributeFilter("href",
                                    "/catalog/movieDetails/" + item.getMovieId())),
                            new NodeClassFilter(ImageTag.class)
                    ),

                    new CssClassFilter("bvr-rating"),
View Full Code Here

          log.debug("Searching url " + searchUrl);
        }
        parser.setURL(searchUrl);

      NodeCollector searchCollector = new NodeCollector(new NodeFilter[] {
          new HasParentFilter(new HasAttributeFilter("id", "tabHeader2")),
          new CssClassFilter("movie"),
      });
       
        parser.extractAllNodesThatMatch(searchCollector);
        Node moviesTab = searchCollector.getNode(0);
View Full Code Here

                                nextToken ();
                                if (tokentype != NAME)
                                    throw new IllegalArgumentException (
                                        "Syntax error at " + token);
                                if (ret == null)
                                    ret = new HasAttributeFilter ("class",
                                        unescape (token));
                                else
                                    ret = new AndFilter (ret, new HasAttributeFilter (
                                        "class", unescape (token)));
                                break;
                            case '#':
                                nextToken ();
                                if (tokentype != NAME)
                                    throw new IllegalArgumentException (
                                        "Syntax error at " + token);
                                if (ret == null)
                                    ret = new HasAttributeFilter ("id", unescape (token));
                                else
                                    ret = new AndFilter (ret, new HasAttributeFilter (
                                        "id", unescape (token)));
                                break;
                            case ':':
                                nextToken ();
                                if (ret == null)
View Full Code Here

        if (tokentype == NAME)
        {
            String attrib = token;
            nextToken ();
            if ("]".equals (token))
                ret = new HasAttributeFilter (unescape (attrib));
            else if (tokentype == RELATION)
            {
                String val = null, rel = token;
                nextToken ();
                if (tokentype == QUOTEDSTRING)
                    val = unescape (token.substring (1, token.length () - 1));
                else if (tokentype == NAME)
                    val = unescape (token);
                if ("~=".equals (rel) && val != null)
                    ret = new AttribMatchFilter (unescape (attrib), "\\b"
                        + val.replaceAll ("([^a-zA-Z0-9])", "\\\\$1")
                        + "\\b");
                else if ("|=".equals (rel) && val != null)
                    ret = new AttribMatchFilter (unescape (attrib), val.replaceAll ("([^a-zA-Z0-9])", "\\\\$1")
                    + "\\-[^a-zA-Z0-9]*");
                else if ("=".equals (rel) && val != null)
                    ret = new HasAttributeFilter (attrib, val);
            }
        }
        if (ret == null)
            throw new IllegalArgumentException ("Syntax error at " + token
                + tokentype);
View Full Code Here

            // recurseHtmlNodes(nodelist, base);
        } // else maybe it is a parsed Flash document? Anyone? :-)
    }
   
    private void processHtml(HttpUrl base, NodeList nodelist) {
        NodeFilter filter = new HasAttributeFilter("href");
        filter = new OrFilter(filter, new HasAttributeFilter("src"));
        filter = new OrFilter(filter, new HasAttributeFilter("onclick"));
        filter = new OrFilter(filter, new HasAttributeFilter("onblur"));
        try {
            NodeList links = nodelist.extractAllNodesThatMatch(filter);
            for (NodeIterator ni = links.elements(); ni.hasMoreNodes(); ) {
                Node node = ni.nextNode();
                if (node instanceof Tag) {
View Full Code Here

        worker.setFilter (
            new NotFilter (
                new OrFilter (
                    new AndFilter (
                        new TagNameFilter ("DIV"),
                        new HasAttributeFilter ("id", "navbar")),
                    new OrFilter (
                        new AndFilter (
                            new TagNameFilter ("DIV"),
                            new HasAttributeFilter ("id", "actionbar")),
                        new AndFilter (
                            new TagNameFilter ("DIV"),
                            new HasAttributeFilter ("id", "xhtml-validator"))))));
        worker.capture ();
       
        System.exit (0);
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.filters.HasAttributeFilter

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.