Package org.jsoup.select

Examples of org.jsoup.select.NodeVisitor


     @param baseUri base URI to set
     */
    public void setBaseUri(final String baseUri) {
        Validate.notNull(baseUri);

        traverse(new NodeVisitor() {
            public void head(Node node, int depth) {
                node.baseUri = baseUri;
            }

            public void tail(Node node, int depth) {
View Full Code Here


  protected String convertNodeToText(Element element) {
    if (element == null)
      return "";
    final StringBuilder buffer = new StringBuilder();
    new NodeTraversor(new NodeVisitor() {
      @Override
      public void head(Node node, int depth) {
        if (node instanceof TextNode) {
          TextNode textNode = (TextNode) node;
          String text = textNode.text().replace('\u00A0', ' ').trim(); // non breaking space
View Full Code Here

     @param baseUri base URI to set
     */
    public void setBaseUri(final String baseUri) {
        Validate.notNull(baseUri);

        traverse(new NodeVisitor() {
            public void head(Node node, int depth) {
                node.baseUri = baseUri;
            }

            public void tail(Node node, int depth) {
View Full Code Here

   * @return a list of nodes belonging to the feedback form's surrounding neighbourhood (including the feedback
   * form itself)
   */
  private List<Node> getFeedbackFormNeighbourhood(final Element feedbackForm) {
    final List<Node> neighbourhood = new ArrayList<>();
    NodeVisitor neighbourhoodFinder = new NodeVisitor() {
      private boolean feedbackFormFound = false;
      private boolean hrTagFound = false;
      @Override
      public void head(Node node, int depth) {
        if (!feedbackFormFound) {
View Full Code Here

    }

    @Test public void traverse() {
        Document doc = Jsoup.parse("<div><p>Hello</p></div><div>There</div>");
        final StringBuilder accum = new StringBuilder();
        doc.select("div").first().traverse(new NodeVisitor() {
            public void head(Node node, int depth) {
                accum.append("<" + node.nodeName() + ">");
            }

            public void tail(Node node, int depth) {
View Full Code Here

     @param baseUri base URI to set
     */
    public void setBaseUri(final String baseUri) {
        Validate.notNull(baseUri);

        traverse(new NodeVisitor() {
            public void head(Node node, int depth) {
                node.baseUri = baseUri;
            }

            public void tail(Node node, int depth) {
View Full Code Here

  private void unwrap(final Element element) {

    final Set<Element> elementsToUnwrap = new LinkedHashSet<>();

    element.traverse(new NodeVisitor() {

      @Override
      public void head(Node node, int depth) {

        if (node instanceof Element) {
View Full Code Here

  private Object extractChildContent(final Element element) {

    final List<String> parts = new LinkedList<>();

    element.traverse(new NodeVisitor() {

      @Override
      public void head(Node node, int depth) {

        if (node instanceof Element) {
View Full Code Here

TOP

Related Classes of org.jsoup.select.NodeVisitor

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.