Package org.vietspider.token.attribute

Examples of org.vietspider.token.attribute.Attribute


    NodeIterator iterator = node.iterator();
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(!n.isNode(Name.A)) continue;
      Attributes attributes = n.getAttributes();
      Attribute attribute = attributes.get("href");
      if(attribute == null) continue;
      String value = attribute.getValue();
      if(value == null) continue;
      if(value.indexOf("page=") > -1) return true;
    }
    return false;
  }
View Full Code Here


     
      for(String value :  values) {
        if(value == null) value = "";
        if(isIgnore(params, name, value)) continue;
        if("radio".equalsIgnoreCase(type) || "checkbox".equalsIgnoreCase(type)) {
          Attribute checked = getAttributeObject(attrs, "checked");
          if(checked == null) continue;
        }
        addParam(params, name, value.trim());
      }
      //end for
View Full Code Here

    if(name1 != name2) return false;
    Attributes attributes1 = node1.getAttributes();
    Attributes attributes2 = node2.getAttributes();
    if(attributes1.size() != attributes2.size()) return false;
    for(int i = 0;  i < attributes1.size(); i++) {
      Attribute attribute1 = attributes1.get(i);
      Attribute attribute2 = attributes2.get(i);
      if(attribute1 == null && attribute2 != nullreturn false;
      if(attribute1 != null && attribute2 == nullreturn false;
      if(attribute1 != null && attribute2 != null
          && !attribute1.getName().equalsIgnoreCase(attribute2.getName()))  return false;
    }
   
    List<HTMLNode> children1 = node1.getChildren();
    List<HTMLNode> children2 = node2.getChildren();
    if(children1 == null && children2 == null) return true;
View Full Code Here

  }
 
  private boolean compare(Attributes attributes1, Attributes attributes2) {
    if(attributes1.size() != attributes2.size()) return false;
    for(int i = 0; i < attributes1.size(); i++) {
      Attribute attr1 = attributes1.get(i);
      Attribute attr2 = attributes2.get(i);
      if(!attr1.getName().equalsIgnoreCase(attr2.getName())) return false;
    }
    return true;
  }
View Full Code Here

    return match(pattern, nodeIndex, 0, -1);
  }
 
  public boolean contains(Attributes attributes, Attribute [] attrs) {
    for(Attribute attr : attrs) {
      Attribute attr1 = attributes.get(attr.getName());
      if(attr1 == null || !attr.getValue().equalsIgnoreCase(attr1.getValue())) return false;
    }
    return true;
  }
View Full Code Here

    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) {
    }
    return new String[0];
View Full Code Here

    }
  }
 
  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("%")) {
      value = value.substring(0, value.length()-1);
      try {
View Full Code Here

    }
  }
 
  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;
    String [] cssValues = cssData.getValue(clazzName);
    for(String css : cssValues) {
View Full Code Here

    return false;
  }
 
  private String getLinkAttribute(HTMLNode node) {
    Attributes attributes = node.getAttributes();
    Attribute attribute = attributes.get("href");
    if(attribute != null) {
      String link = attribute.getValue();
      if(link != null && !(link = link.trim()).isEmpty()) {
        if(link.charAt(0) == '#') return null;
        return link;
      }
    }
    attribute = attributes.get("onclick");
    if(attribute == null) return  null;
    String link = attribute.getValue();
    if(link == null
        || (link = link.trim()).isEmpty()
        || link.charAt(0) == '#') return null;
    return link;
  }
View Full Code Here

    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) {
    }
    return new String[0];
View Full Code Here

TOP

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

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.