Package org.vietspider.token.attribute

Examples of org.vietspider.token.attribute.Attributes


      return ERROR;
    }
   
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    for(i = 0 ; i < inputs.size(); i++) {
      Attributes attrs = inputs.get(i).getAttributes();
      String name = getAttribute(attrs, NAME_ATTR);
      if(name == null) getAttribute(attrs, ID_ATTR);
      if(name == null) continue;
      String type = getAttribute(attrs, TYPE_ATTR);
      if(type == null) type = "text";
View Full Code Here


    return SUCCESSFULL;
  }

  public String getAttribute(HTMLNode node, String name) {
    Attributes attrs = node.getAttributes();
    int idx = attrs.indexOf(name);
    if(idx < 0) return null;
    return attrs.get(idx).getValue();
  }
View Full Code Here

*/
public class NodeComparator {
 
  public boolean compare(HTMLNode node1, HTMLNode node2) {
    if(node1.getName() != node2.getName()) return false;
    Attributes attributes1 = node1.getAttributes();
    Attributes attributes2 = node2.getAttributes();
    if(!compare(attributes1, attributes2)) return false;
    return compare(node1.getChildren(), node2.getChildren());
  }
View Full Code Here

        if(attrs == null || attrs.length < 1) {
//          System.out.println(" da xay ra roi ");
          htmlValues.add(childNode);
        } else {
//          System.out.println(" xay ra ");
          Attributes nodeAttributes = childNode.getAttributes();
          if(matcher.contains(nodeAttributes, attrs)) htmlValues.add(childNode);
        }
      }
      counter++;
   
View Full Code Here

    String address = getAttribute(form, ACTION);
    if(address == null) return false;
   
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    for(int i = 0 ; i < inputs.size(); i++) {
      Attributes attrs = inputs.get(i).getAttributes();
      String name = getAttribute(attrs, NAME_ATTR);
      if(name == null) getAttribute(attrs, ID_ATTR);
      if(name == null) continue;
      String type = getAttribute(attrs, TYPE_ATTR);
      if(type == null) type = "text";
View Full Code Here

    return !error;
  }

  private String getAttribute(HTMLNode node, String name) {
    Attributes attrs = node.getAttributes();
    int idx = attrs.indexOf(name);
    if(idx < 0) return null;
    return attrs.get(idx).getValue();
  }
View Full Code Here

  }
 
  private String[] getAttributes(HTMLNode node) {
    if(node == null) return new String[0];
    try {
      Attributes attributes = node.getAttributes();
      String [] values = new String[attributes.size()];
      for(int i = 0; i < attributes.size(); i++) {
        Attribute attr = attributes.get(i);
        values[i] = "[" + attr.getName()+"=" + attr.getValue() + "]";
      }
      return values;
    } catch(Exception exp) {
    }
View Full Code Here

      searchNodes(children.get(i));
    }
  }
 
  public boolean isGreater(HTMLNode node, int width, int rate) {
    Attributes attributes = getAttributes(node);
    Attribute attribute = attributes.get("width");
    if(attribute == null) return false;
    String value = attribute.getValue();
    if(value == null) return false;
    value = value.trim();
    /*if(value.endsWith("%")) {
View Full Code Here

      return false;
    }
  }
 
  public Attributes getAttributes(HTMLNode node) {
    Attributes attributes = node.getAttributes();
    Attribute attribute = attributes.get("class");
    if(attribute == null) return attributes;
    String clazzName  = attribute.getValue();
    if(clazzName == null) return attributes;
    CSSData cssData = document.getResource("CSS.DATA");
    if(cssData == null) return attributes;
View Full Code Here

      HTMLNode n = nodes.get(i);
      if(n.isNode(Name.OBJECT))  {
        score += 1000;
      } else if(n.isNode(Name.IMG))  {
//        System.out.println(new String(n.getValue()));
        Attributes attributes = n.getAttributes();
        score += calculateFromAttr(attributes.get("width"));
        score += calculateFromAttr(attributes.get("height"));
      }
    }
   
  }
View Full Code Here

TOP

Related Classes of org.vietspider.token.attribute.Attributes

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.