Package org.vietspider.token.attribute

Examples of org.vietspider.token.attribute.Attribute


    Iterator<String> iter = keys.iterator();
    while(iter.hasNext()){
      String key = iter.next();
      if(node.isNode(key) || (key.length() == 1 && key.charAt(0) == '*')){
        Attributes attrs = node.getAttributes()
        Attribute attr = attrs.get(map.get(key));
        if(attr == nullcontinue;
        String value = attr.getValue();
        if(value == null) continue;
        if(verifier != null && !verifier.verify(value)) continue;
//        System.out.println("truoc "+value);
        value  = urlCreator.createURL(home, value);
//        System.out.println("sau "+value);
        attr.setValue(value);     
        attrs.set(attr);
      }
    } 
  }
View Full Code Here


    }
  }
 
  private void createFullSingleLink(HTMLNode node,
      String nodeName, String attrName, URL home, ValueVerifier verifier)   {
    Attribute attr = null;
    if(node.isNode(nodeName) || (nodeName.length() == 1 && nodeName.charAt(0) == '*')) {
      Attributes attrs = node.getAttributes()
      int idx = attrs.indexOf(attrName);
      if(idx < 0return;
      attr = attrs.get(idx);
      String value = attr.getValue();
      if(verifier != null && !verifier.verify(value)) return;
      value  = urlCreator.createURL(home, value);     
      attr.setValue(value);     
      attrs.set(attr);
    }
  }
View Full Code Here

    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(!n.isNode(Name.META)) continue;
      if(n.isNode(Name.BODY)) break;
      Attributes attributes = n.getAttributes();
      Attribute attribute = attributes.get("http-equiv");
      if(attribute == null || attribute.getValue() == null) continue;

      if(!"content-type".equalsIgnoreCase(attribute.getValue().trim())) continue ;

      attribute = attributes.get("content");
      if(attribute == null) continue;
      String link = attribute.getValue();
      if(link == null) continue;
      int index = link.toLowerCase().indexOf("=");

      return link.substring(index+1);
    }
View Full Code Here

    Iterator<String> iter = keys.iterator();
    while(iter.hasNext()){
      String key = iter.next();
      if(node.isNode(key) || (key.length() == 1 && key.charAt(0) == '*')){
        Attributes attrs = node.getAttributes()
        Attribute attr = attrs.get("src");
        if(attr == nullcontinue;
        String value = attr.getValue();
        if(verifier != null && !verifier.verify(value)) continue;
        value  = urlCreator.createURL(home, value);
        attr.setValue(value);     
        attrs.set(attr);
      }
    } 
  }
View Full Code Here

    }
  }
 
  private void createFullSingleLink(HTMLNode node,
      String nodeName, String attrName, URL home, ValueVerifier verifier)   {
    Attribute attr = null;
    if(node.isNode(nodeName) || (nodeName.length() == 1 || nodeName.charAt(0) == '*')) {
      Attributes attrs = node.getAttributes()
      int idx = attrs.indexOf(attrName);
      if(idx < 0return;
      attr = attrs.get(idx);
      String value = attr.getValue();
      if(verifier != null && !verifier.verify(value)) return;
      value  = urlCreator.createURL(home, value);     
      attr.setValue(value);     
      attrs.set(attr);
    }
  }
View Full Code Here

    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(!n.isNode(Name.META)) continue;
      if(n.isNode(Name.BODY)) break;
      Attributes attributes = n.getAttributes();
      Attribute attribute = attributes.get("http-equiv");
      if(attribute == null || attribute.getValue() == null) continue;

      if(!"content-type".equalsIgnoreCase(attribute.getValue().trim())) continue ;

      attribute = attributes.get("content");
      if(attribute == null) continue;
      String link = attribute.getValue();
      if(link == null) continue;
      int index = link.toLowerCase().indexOf("=");

      return link.substring(index+1);
    }
View Full Code Here

  public List<String> getAttributes(HTMLNode node, Map<String, String> map, ValueVerifier verifier) {
    return getAttributes(node, null, map, verifier);  
  }
 
  public String getAttribute(HTMLNode node, Map<String, String> map, ValueVerifier verifier) {  
    Attribute attr = getAttribute(node, map);   
    if(attr != null
      && (verifier == null || verifier.verify(attr.getValue()))) return  attr.getValue();
   
    List<HTMLNode> children = node.getChildrenNode();
    for(int i = 0; i < children.size(); i++) {
      String link = getAttribute(children.get(i), map, verifier);
      if(link != null) return link;
View Full Code Here

    }
    return null;
 
 
  public String getAttribute(HTMLNode node, String nodeName, String attrName, ValueVerifier verifier) {  
    Attribute attr = getAttribute(node, nodeName, attrName);   
    if(attr != null
      && (verifier == null || verifier.verify(attr.getValue()))) return attr.getValue();
      
    List<HTMLNode> children = node.getChildrenNode();
    for(int i = 0; i < children.size(); i++) {
      String link = getAttribute(children.get(i), nodeName, attrName, verifier);
      if(link != null) return link;
View Full Code Here

  }
 
  public List<String> getAttributes(HTMLNode node, List<String> list,
                                    Map<String, String> map, ValueVerifier verifier){  
    if(list == null) list  = new ArrayList<String>();
    Attribute attr = getAttribute(node, map);   
    if(attr != null
        && (verifier == null || verifier.verify(attr.getValue()))) list.add(attr.getValue());
   
    List<HTMLNode> children = node.getChildrenNode();
    for(int i = 0; i < children.size(); i++) {
      getAttributes(children.get(i), list, map, verifier);
    }
View Full Code Here

  }
 
  public List<String> getAttributes(HTMLNode node, List<String> list,
                        String nodeName, String attrName, ValueVerifier verifier){  
    if(list == null) list  = new ArrayList<String>();
    Attribute attr = getAttribute(node, nodeName, attrName);   
    if(attr != null
       && (verifier == null || verifier.verify(attr.getValue()))) list.add(attr.getValue());
   
    List<HTMLNode> children = node.getChildrenNode();
    for(int i = 0; i < children.size(); i++) {
      getAttributes(children.get(i), list, nodeName, attrName, verifier);      
    }
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.