Package org.vietspider.html.path2

Examples of org.vietspider.html.path2.ExpComputor


  }
 
  public void setNode(HTMLNode node){
    setName(node.getName().toString());
    setValue(new String(node.getValue()));   
    NodePath path = new NodePathParser().toPath(node);
    setPathName(path.toString());
    if(node.getChildren() != null ){
      setTotalChildren(node.getChildren().size());
      setAttributes(node.getAttributes());
    }
    shell.pack();
View Full Code Here


    }
  }

  private void search(String start, String end){
    try{
      NodePath path = webClient.findNodeByText(document.getRoot(), start, end);  
      if(path == null) return;
      short selectType = PathConfirmDialog.YES;
      handler.traverseTree(tree, path, TreeHandler.NONE, selectType);     
    } catch(Exception exp){
      ClientLog.getInstance().setMessage(tree.getShell(), exp);
View Full Code Here

          NodePathParser pathParser = new NodePathParser();
          if(hyperlinkUtil == null) hyperlinkUtil = new HyperLinkUtil();
          HTMLNode header = null;
          HTMLNode body = null;
          try {
            NodePath nodePath  = pathParser.toPath("HEAD");
            header = extractor.lookNode(document.getRoot(), nodePath);
            nodePath  = pathParser.toPath("BODY");
            body = extractor.lookNode(document.getRoot(), nodePath);
          } catch (Exception e) {
            ClientLog.getInstance().setException(getShell(), e);
View Full Code Here

   
    HTMLExtractor extractor  = new HTMLExtractor();
    NodePathParser pathParser = new NodePathParser();
   
    try {
      NodePath nodePath  = pathParser.toPath(txt);
      HTMLNode node = extractor.lookNode(document.getRoot(), nodePath);
      if(node == null) return;
      if(node.isNode(Name.CONTENT)
          || node.isNode(Name.COMMENT)
          || node.isNode(Name.UNKNOWN)) {
        browser.setText(node.getTextValue());
        return;
      }
     
      NodePath headerPath  = pathParser.toPath("HEAD");
      HTMLNode header = extractor.lookNode(document.getRoot(), headerPath);
   
      if(toolbar.isShowAll()) {
        if(hyperlinkUtil == null) hyperlinkUtil = new HyperLinkUtil();
        try {
View Full Code Here

    NodePathParser pathParser = new NodePathParser();
    for(TreeItem item : items) {
      String pathIndex = handler.getConfig(item);
      try {
        NodeInfoViewer viewer = new NodeInfoViewer(getShell(), x, y);
        NodePath nodePath = pathParser.toPath(pathIndex);
        HTMLNode node = extractor.lookNode(document.getRoot(), nodePath);
        viewer.setNode(node);  
        x += 10;
        y += 10;
        nodeViewers.add(viewer);
View Full Code Here

    List<String> removePaths = new ArrayList<String>();
    NodePathParser pathParser = new NodePathParser();
    if(paths != null) {
      short selectType = PathConfirmDialog.YES;
      for(String path : paths) {
        NodePath nodePath = pathParser.toPath(path);
        selectType = handler.traverseTree(tree, nodePath, path, style, selectType);
        if(selectType == PathConfirmDialog.YES
            || selectType == PathConfirmDialog.YES_TO_ALL) {
          removePaths.add(path);
        }
View Full Code Here

  private HTMLNode searchTitleNode(HTMLNode root, HTMLNode node) {
    HTMLExtractor extractor  = new HTMLExtractor();
    NodePathParser pathParser = new NodePathParser();
    String title = "title";
    try {
      NodePath nodePath  = pathParser.toPath("HEAD.TITLE");
      HTMLNode titleNode = extractor.lookNode(root, nodePath);
      if(titleNode.hasChildren()) {
        title  = titleNode.getChild(0).getTextValue();
      }
    } catch (Exception e) {
View Full Code Here

  private String [] build(List<NodeImpl> tokens) throws Exception {
    HTMLDocument doc = new HTMLParser2().createDocument(tokens);
    NodePathParser pathParser = new NodePathParser();
    HTMLExtractor extractor  = new HTMLExtractor();
   
    NodePath nodePath  = pathParser.toPath("BODY");
    HTMLNode body = extractor.lookNode(doc.getRoot(), nodePath);
   
    TextRenderer renderer = new TextRenderer(body, TextRenderer.HANDLER);
    String value = renderer.getTextValue().toString();
    return value.trim().split("\n");
View Full Code Here

   

    HTMLExtractor extractor  = new HTMLExtractor();
    NodePathParser pathParser = new NodePathParser();

    NodePath nodePath  = pathParser.toPath("BODY");
    return extractor.lookNode(document.getRoot(), nodePath);
  }
View Full Code Here

   

    HTMLExtractor extractor  = new HTMLExtractor();
    NodePathParser pathParser = new NodePathParser();

    NodePath nodePath  = pathParser.toPath("BODY");
    return extractor.lookNode(document.getRoot(), nodePath);
  }
View Full Code Here

TOP

Related Classes of org.vietspider.html.path2.ExpComputor

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.