Package org.vietspider.html

Examples of org.vietspider.html.NodeIterator


    }*/
  }
 
  public void buildText(StringBuilder builder, HTMLNode node) {
    if(node == null) return;
    NodeIterator iterator = node.iterator();
   
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(!n.isNode(Name.CONTENT)) continue;
      if(builder.length() > 0) builder.append(' ');
      builder.append(n.getValue());
    }
  }
View Full Code Here


    }
  }
 
  public void searchText(List<HTMLNode> values, HTMLNode node) {
    if(node == null) return;
    NodeIterator iterator = node.iterator();
   
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(n.isNode(Name.CONTENT)) values.add(n);
    }
  }
View Full Code Here

      searchText(values, node);
      return;
    }
   
    if(node == null) return;
    NodeIterator iterator = node.iterator();
   
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(!n.isNode(Name.CONTENT)) continue;
      char [] chars = n.getValue();
      if(verify.isValid(chars)) values.add(n);
    }
  }
View Full Code Here

* Author : Nhu Dinh Thuan nhudinhthuan@yahoo.com Oct 12, 2007
*/
public class HTMLAnchorUtil extends HTMLNodePath {

  public final void searchAnchors(HTMLNode node, List<HTMLNode> anchors) {  
    NodeIterator iterator = node.iterator();
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if (n.isNode(Name.A)) {
        Attributes attrs = n.getAttributes();
        Attribute attr = attrs.get("name");
        if (attr != null) anchors.add(n);
      }
View Full Code Here

  public List<String> getValues() { return list; }
 
  public void handle(HTMLNode node) {
    if(node == null) return;
    NodeIterator iterator = node.iterator();
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
     
      handleNode(n);
     
      if(!n.isTag()) continue;
      Attribute attr = getAttribute(n);
View Full Code Here

    }
    return null;
  }
 
  public String getAttributeValue(HTMLNode node) {  
    NodeIterator iterator = node.iterator();
    while(iterator.hasNext()) {
      Attribute attr = getAttribute(iterator.next());   
      if(attr != null
        && (verifier == null || verifier.verify(attr.getValue()))) return attr.getValue()
    }
    return null;
  }
View Full Code Here

    List<String> list = handler.getValues();
   
    handler = new IdentifierAttributeHandler(list, jsVerifier, "a", "href");
    handler.handle(root);
   
    NodeIterator iterator = root.iterator();
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(!n.isNode(Name.SCRIPT)) continue;
      if(n.getChildren().size() < 1) continue;
      list.add(n.getChild(0).getTextValue());
    }
    return list;
View Full Code Here

  }
 
  public synchronized void createFullLink(HTMLNode node,
      Map<String, String> map, URL home, ValueVerifier verifier) {
    if(node == null) return;
    NodeIterator iterator = node.iterator();
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(n.isTag()) createFullSingleLink(n, map, home, verifier);
    }
  }
View Full Code Here

   
  }
 
  public void createFullLink(HTMLNode node,
      String nodeName, String attrName, URL home, ValueVerifier verifier) {
    NodeIterator iterator = node.iterator();
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(n.isTag()) createFullSingleLink(n, nodeName, attrName, home, verifier);
    }
  }
View Full Code Here

    }
    return true;
  }
 
  private boolean isChild(HTMLNode parent, HTMLNode node) {
    NodeIterator iterator = parent.iterator();
    while(iterator.hasNext()) {
      HTMLNode n = iterator.next();
      if(n == node) return true;
    }
//    if(node == parent) return true;
//    List<HTMLNode> children  = parent.getChildren();
//    if(children == null || children.size() < 1) return false;
View Full Code Here

TOP

Related Classes of org.vietspider.html.NodeIterator

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.