Package org.vietspider.html

Examples of org.vietspider.html.Name


  }

  private void buildValue(StringBuilder builder, NodeImpl node){
    builder.append(SpecChar.n);

    Name name = node.getName();
    char [] value = node.getValue();

    if(name == Name.CONTENT || name == Name.COMMENT) {
      builder.append(value);
      return;
View Full Code Here


    }
    return true;
  }
 
  private boolean equalsFormat(HTMLNode node1, HTMLNode node2) {
    Name name1 = node1.getName();
    Name name2 = node2.getName();
    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++) {
View Full Code Here

  }
 
  private Node toNode(HTMLNode htmlParent, HTMLNode htmlNode){
    List<HTMLNode> htmlChildren  = htmlParent.getChildren();
    int counter = 0;
    Name name = htmlNode.getName();
    for(int i = 0; i < htmlChildren.size(); i++) {
      if(htmlChildren.get(i) == htmlNode) break;
      if(htmlChildren.get(i).getName() == name) counter++;
    }
    return new Node(htmlNode.getName(), counter, null);
View Full Code Here

      String attr = element.substring(bracketStart+1, bracketEnd).trim();
      attributes = AttributeParser.parse(attr);
    }
   
    boolean anyNode = value.length() == 1 && value.charAt(0) == ExpComputor.C_ANY;
    Name name = anyNode ? Name.ANY : Name.valueOf(value);
    if(attributes != null) {
      return new NodeExp(name, index.trim(), attributes);
    } else if(isNumber(index)) {
      return new Node(name, Integer.parseInt(index), attributes);
    }
View Full Code Here

    }
    return count;
  }
 
  private int getStyle(HTMLNode element){
    Name name = element.getConfig().name();
    if(name == Name.CONTENT) return -2;
    if(name == Name.COMMENT || name == Name.CODE_CONTENT) return -1;
    return sizeOfContent(element);
  }
View Full Code Here

    if(start >= end) return end;
    if(start > data.length) return data.length; 
//    char [] value = CharsUtil.cutAndTrim(data, start, Math.min(end, data.length));
    char [] value = cutAndTrim(data, start, Math.min(end, data.length), replaces);
  
    Name name;
    if(value.length < 1) return end;
   
    if(type != TypeToken.TAG){    
      if(type == TypeToken.DOCTYPE) {
        name = Name.DOCTYPE;
View Full Code Here

public class HTMLTokenUtils {
 
  public static String buildTextContent(List<NodeImpl> tokens) {
    StringBuilder buildContent = new StringBuilder();
    for(int i = 0; i < tokens.size(); i++) {
      Name name = tokens.get(i).getName();
      char [] value = tokens.get(i).getValue();
     
      if(name == Name.CONTENT) buildContent.append(value);
    }
    return buildContent.toString();
View Full Code Here

  }
 
  public static void buildContent(StringBuilder builder, NodeImpl node){
    builder.append(SpecChar.n);

    Name name = node.getName();
    char [] value = node.getValue();

    if(name == Name.CONTENT || name == Name.COMMENT) {
      builder.append(value);
      return;
View Full Code Here

  }

  private final NodeImpl createNode(List<Name[]> list, NodeImpl parent){
    NodeImpl child = null;
    for(Name[] names : list){
      Name name = names[0];
      child = new NodeImpl(name.toString().toCharArray(), name, TypeToken.TAG);     
      if(child.getConfig().only()) {
        parent = service.getNodeSetter().set(child);
      } else {
        parent.addInternalChild(child);
//        child.setParent(parent);
View Full Code Here

  }
 
  private void buildValue(StringBuilder builder, NodeImpl node){
    builder.append(SpecChar.n);
   
    Name name = node.getName();
    char [] value = node.getValue();
   
    if(name == Name.CONTENT || name == Name.COMMENT) {
      builder.append(value);
      return;
View Full Code Here

TOP

Related Classes of org.vietspider.html.Name

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.