Package org.vietspider.html

Examples of org.vietspider.html.HTMLNode.addChild()


      List<HTMLNode> values = getNodes(doc);
      if(values.size() > 0) {
        parent.setChild(i, values.get(0));
//        childen.set(i, values.get(0));
        for(int k = 1; k < values.size(); k++) {
          parent.addChild(i+k, values.get(k));
//          childen.add(i+k, values.get(k));
        }
      }
     
      return;
View Full Code Here


      List<HTMLNode> htmlNodes = matchNodes(root, nodePaths[i]);
      if(htmlNodes == null ) continue;
      for(HTMLNode htmlNode : htmlNodes) {
        if(htmlNode == null) continue;
//        extractTokens(tokens, newTokens, htmlNode);
        newRoot.addChild(htmlNode);
//        htmlNode.setParent(newRoot);
      }
    }
   
    newDocument.setRoot(newRoot);
View Full Code Here

    HTMLDocument [] newDocuments = new HTMLDocument[htmlValues.size()];

    for(int i = 0; i < htmlValues.size(); i++) {
      HTMLNode html = HTMLParser2.clone(root);
      if(htmlValues.get(i) == null) continue;
      html.addChild(htmlValues.get(i));
//      htmlValues.get(i).setParent(html);
      for(int j = 1; j < listHtmlValues.size(); j++) {
        List<HTMLNode> newHtmlValues = listHtmlValues.get(j);
        if(i > newHtmlValues.size()) break;
        try {
View Full Code Here

      for(int j = 1; j < listHtmlValues.size(); j++) {
        List<HTMLNode> newHtmlValues = listHtmlValues.get(j);
        if(i > newHtmlValues.size()) break;
        try {
          if(newHtmlValues.get(i) == null) continue;
          html.addChild(newHtmlValues.get(i));
//          newHtmlValues.get(i).setParent(html);
        } catch (Exception e) {
          continue;
        }
      }
View Full Code Here

    NodePathParser pathParser = new NodePathParser();
    HTMLExtractor extractor = new HTMLExtractor();
    try {
      HTMLNode body = extractor.lookNode(root, pathParser.toPath("BODY"));
      body.clearChildren();
      body.addChild(newRoot);
    } catch (Exception e) {
      LogService.getInstance().setThrowable(e);
    }
    return document;
  }
View Full Code Here

      HTMLNode newCommonNode =
        new NodeImpl(commonNode.getValue(), commonNode.getName(), TypeToken.TAG);
      List<HTMLNode> children = commonNode.getChildren();
      for (i = idx; i < nextIdx; i++) {
        newCommonNode.addChild(children.get(i));
      }
      return newCommonNode;
    } catch (Exception e) {
      // LogService.getInstance().setMessage(e.toString());
      return root;
View Full Code Here

      HTMLNode newCommonNode = new NodeImpl(commonNode.getValue(), commonNode.getName(),
          TypeToken.TAG);
      List<HTMLNode> children = commonNode.getChildren();
      for (i = idx; i < children.size(); i++) {
        newCommonNode.addChild(children.get(i));
        // children.get(i).setParent(newCommonNode);
      }
      return newCommonNode;
    } catch (Exception e) {
      StringBuilder builder = new StringBuilder();
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.