Package org.jsoup.select

Examples of org.jsoup.select.NodeTraversor


  protected static String convertNodeToText(Node node) {
    if (node == null)
      return "";
    StringBuilder buffer = new StringBuilder();
    new NodeTraversor(new ToTextNodeVisitor(buffer)).traverse(node);
    return buffer.toString().trim();
  }
View Full Code Here


  protected static String convertElementsToText(Elements elements) {
    if (elements == null || elements.isEmpty())
      return "";
    StringBuilder buffer = new StringBuilder();
    NodeTraversor nt = new NodeTraversor(new ToTextNodeVisitor(buffer));
    for (Element element : elements) {
      nt.traverse(element);
    }
    return buffer.toString().trim();
  }
View Full Code Here

            URLCollection coll, String encoding) throws HTMLParseException {
        try {
            String contents = new String(html,encoding);
            Document doc = Jsoup.parse(contents);
            JMeterNodeVisitor nodeVisitor = new JMeterNodeVisitor(new URLPointer(baseUrl), coll);
            new NodeTraversor(nodeVisitor).traverse(doc);
            return coll.iterator();
        } catch (Exception e) {
            throw new HTMLParseException(e);
        }
    }
View Full Code Here

            URLCollection coll, String encoding) throws HTMLParseException {
        try {
            String contents = new String(html,encoding);
            Document doc = Jsoup.parse(contents);
            JMeterNodeVisitor nodeVisitor = new JMeterNodeVisitor(new URLPointer(baseUrl), coll);
            new NodeTraversor(nodeVisitor).traverse(doc);
            return coll.iterator();
        } catch (Exception e) {
            throw new HTMLParseException(e);
        }
    }
View Full Code Here

        outerHtml(accum);
        return accum.toString();
    }

    protected void outerHtml(StringBuilder accum) {
        new NodeTraversor(new OuterHtmlVisitor(accum, getOutputSettings())).traverse(this);
    }
View Full Code Here

        outerHtml(accum);
        return accum.toString();
    }

    protected void outerHtml(StringBuilder accum) {
        new NodeTraversor(new OuterHtmlVisitor(accum, getOutputSettings())).traverse(this);
    }
View Full Code Here

     * @param nodeVisitor the visitor callbacks to perform on each node
     * @return this node, for chaining
     */
    public Node traverse(NodeVisitor nodeVisitor) {
        Validate.notNull(nodeVisitor);
        NodeTraversor traversor = new NodeTraversor(nodeVisitor);
        traversor.traverse(this);
        return this;
    }
View Full Code Here

        outerHtml(accum);
        return accum.toString();
    }

    protected void outerHtml(StringBuilder accum) {
        new NodeTraversor(new OuterHtmlVisitor(accum, getOutputSettings())).traverse(this);
    }
View Full Code Here

        try {
            // TODO Handle conditional comments for IE
            String contents = new String(html,encoding);
            Document doc = Jsoup.parse(contents);
            JMeterNodeVisitor nodeVisitor = new JMeterNodeVisitor(new URLPointer(baseUrl), coll);
            new NodeTraversor(nodeVisitor).traverse(doc);
            return coll.iterator();
        } catch (Exception e) {
            throw new HTMLParseException(e);
        }
    }
View Full Code Here

  protected static String convertNodeToText(Node node) {
    if (node == null)
      return "";
    StringBuilder buffer = new StringBuilder();
    new NodeTraversor(new ToTextNodeVisitor(buffer)).traverse(node);
    return buffer.toString().trim();
  }
View Full Code Here

TOP

Related Classes of org.jsoup.select.NodeTraversor

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.