Package org.vietspider.html.path2

Examples of org.vietspider.html.path2.NodePathParser.toPath()


    TextHandler textHandler = new TextHandler();
    if(start == null || start.trim().length() == 0) return pathParser.toPath(node);
    start = textHandler.trim(start);
    HTMLNode startNode = textHandler.findByText(node, start, decoder);
    if(end == null || end.trim().length() == 0) {
      return startNode != null ?  pathParser.toPath(startNode) : pathParser.toPath(node);
    }
    end = textHandler.trim(end);
   
    HTMLNode endNode = textHandler.findByText(node, end, decoder);   
    if(endNode == null)
View Full Code Here


    }
    end = textHandler.trim(end);
   
    HTMLNode endNode = textHandler.findByText(node, end, decoder);   
    if(endNode == null)
      return startNode != null ? pathParser.toPath(startNode) : pathParser.toPath(node);
    if(startNode  == null
      return endNode != null  ?  pathParser.toPath(endNode) : pathParser.toPath(node);
    HTMLNodeUtil nodeUtil = new HTMLNodeUtil()
    String indexPath = nodeUtil.getCommonIndexPath(startNode, endNode);
    return pathParser.toPath(nodeUtil.getNodeByIndex(node, indexPath));
View Full Code Here

    }
    end = textHandler.trim(end);
   
    HTMLNode endNode = textHandler.findByText(node, end, decoder);   
    if(endNode == null)
      return startNode != null ? pathParser.toPath(startNode) : pathParser.toPath(node);
    if(startNode  == null
      return endNode != null  ?  pathParser.toPath(endNode) : pathParser.toPath(node);
    HTMLNodeUtil nodeUtil = new HTMLNodeUtil()
    String indexPath = nodeUtil.getCommonIndexPath(startNode, endNode);
    return pathParser.toPath(nodeUtil.getNodeByIndex(node, indexPath));
View Full Code Here

   
    HTMLNode endNode = textHandler.findByText(node, end, decoder);   
    if(endNode == null)
      return startNode != null ? pathParser.toPath(startNode) : pathParser.toPath(node);
    if(startNode  == null
      return endNode != null  ?  pathParser.toPath(endNode) : pathParser.toPath(node);
    HTMLNodeUtil nodeUtil = new HTMLNodeUtil()
    String indexPath = nodeUtil.getCommonIndexPath(startNode, endNode);
    return pathParser.toPath(nodeUtil.getNodeByIndex(node, indexPath));
  }
View Full Code Here

   
    HTMLNode endNode = textHandler.findByText(node, end, decoder);   
    if(endNode == null)
      return startNode != null ? pathParser.toPath(startNode) : pathParser.toPath(node);
    if(startNode  == null
      return endNode != null  ?  pathParser.toPath(endNode) : pathParser.toPath(node);
    HTMLNodeUtil nodeUtil = new HTMLNodeUtil()
    String indexPath = nodeUtil.getCommonIndexPath(startNode, endNode);
    return pathParser.toPath(nodeUtil.getNodeByIndex(node, indexPath));
  }
View Full Code Here

      return startNode != null ? pathParser.toPath(startNode) : pathParser.toPath(node);
    if(startNode  == null
      return endNode != null  ?  pathParser.toPath(endNode) : pathParser.toPath(node);
    HTMLNodeUtil nodeUtil = new HTMLNodeUtil()
    String indexPath = nodeUtil.getCommonIndexPath(startNode, endNode);
    return pathParser.toPath(nodeUtil.getNodeByIndex(node, indexPath));
  }

}
View Full Code Here

      path  = path.substring(0, path.length() - 2);
    } else  if(path.endsWith("[")) {
      path  = path.substring(0, path.length() - 1);
    }
    try {
      NodePath nodePath = pathParser.toPath(path);
      return extractor.lookNode(explorer.getDocument().getRoot(), nodePath);
    } catch (Exception e) {
    }
    return null;
  }
View Full Code Here

  private void autoSelect() {
    if(type == HTMLExplorer.NONE) return;
    NodePath bodyPath = null;
    NodePathParser pathParser = new NodePathParser();
    try {
      bodyPath  = pathParser.toPath("BODY");
    }catch (Exception e) {
      ClientLog.getInstance().setException(tree.getShell(), e);
    }
   
    if(bodyPath == null || document == null) return;
View Full Code Here

      searchSectionCSS(commons, list, body);

      short selectType = PathConfirmDialog.YES;
      for(HTMLNode ele : commons) {
        try {
          NodePath path = pathParser.toPath(ele);  
          if(path == null) continue;
          selectType = handler.traverseTree(tree, path, TreeHandler.MARK, selectType);     
        } catch(Exception exp){
          ClientLog.getInstance().setMessage(tree.getShell(), exp);
       
View Full Code Here

        maxNodeContent = ele;
      }

      if(count < 100) continue;

      NodePath path = pathParser.toPath(ele);  
      if(path == null) continue;
      handler.traverseTree(tree, path, TreeHandler.MARK, selectType);
      if(!traverse) traverse = true;
    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.