Package org.jsoup.nodes

Examples of org.jsoup.nodes.Element.select()


    protected void addExamples(Document doc, StringBuilder builder) {
        Elements tables = doc.getElementsByTag("table");
        if (!tables.isEmpty()) {
            builder.append("Examples:\n");
            Element table = tables.first();
            Elements headers = table.select("tr").first().select("th");
            for (Element header : headers) {
                builder.append("|").append(header.text());
            }
            builder.append("|\n");
            Elements data = table.select("tr");
View Full Code Here


            Elements headers = table.select("tr").first().select("th");
            for (Element header : headers) {
                builder.append("|").append(header.text());
            }
            builder.append("|\n");
            Elements data = table.select("tr");
            for (int i = 1; i < data.size(); i++) {
                for (Element cell : data.get(i).select("td")) {
                    builder.append("|").append(cell.text());
                }
                builder.append("|\n");
View Full Code Here

  JsonObject status = new JsonObject();

  Document doc = Jsoup.parse(html);
  Element tweet_div = doc.select("div.permalink-tweet").first();

  String tweet_text = tweet_div.select("p.tweet-text").first().text();
  status.addProperty("text", tweet_text);

  String tweet_id = tweet_div.attr("data-tweet-id");
  status.addProperty("id_str", tweet_id);
  status.addProperty("id", Long.parseLong(tweet_id));
View Full Code Here

    }

    public void containsListOfBooks(Collection<Book> books) {
        for (Book book : books) {
            Element bookRow = html.select("#" + book.getId()).first();
            assertEquals("" + book.getId(), bookRow.select(".id").text());
            assertEquals(book.getTitle(), bookRow.select(".title").text());
            assertEquals(book.getAuthor(), bookRow.select(".author").text());
        }
    }
}
View Full Code Here

    public void containsListOfBooks(Collection<Book> books) {
        for (Book book : books) {
            Element bookRow = html.select("#" + book.getId()).first();
            assertEquals("" + book.getId(), bookRow.select(".id").text());
            assertEquals(book.getTitle(), bookRow.select(".title").text());
            assertEquals(book.getAuthor(), bookRow.select(".author").text());
        }
    }
}
View Full Code Here

    public void containsListOfBooks(Collection<Book> books) {
        for (Book book : books) {
            Element bookRow = html.select("#" + book.getId()).first();
            assertEquals("" + book.getId(), bookRow.select(".id").text());
            assertEquals(book.getTitle(), bookRow.select(".title").text());
            assertEquals(book.getAuthor(), bookRow.select(".author").text());
        }
    }
}
View Full Code Here

    List<Transaction> transactions = new ArrayList<Transaction>();

    Document doc = Jsoup.parse(pResponse.body());
    Element transactionTable = doc.getElementById("table-txnsCard0");
    if (transactionTable != null) {
      for (Element transaction : transactionTable.select("tbody tr")) {
        transactions.add(parseTransaction(transaction));
      }
    }
    return transactions;
  }
View Full Code Here

  }

  private List<Account> parseAccounts(Document pDocument) {
    List<Account> accountList = new ArrayList<Account>();
    Element element = pDocument.getElementById("balanceForm:accountsList");
    Elements accounts = element.select("td a[href=#]");
    Matcher vMatcher;
    for (Element rawAccount : accounts) {
      Account account = new Account();
      account.setAccountNumber(rawAccount.text());
      vMatcher = PATTERN_ACCOUNT_ID.matcher(rawAccount.attr("onclick"));
View Full Code Here

        // replace all links !!
        Document document = Jsoup.parse( is, "UTF-8", "" );

        Element body = document.body().child( 0 );

        Elements links = body.select( "a[href]" );

        for ( Element link : links ) {
            link.attr( "href", "#" + startPath + "/" + link.attr( "href" ) );
        }
View Full Code Here

        for ( Element link : links ) {
            link.attr( "href", "#" + startPath + "/" + link.attr( "href" ) );
        }

        Elements codes = body.select( "code" );

        for ( Element code : codes ) {
            code.attr( "class", code.attr( "class" ) + " nice-code" );
        }
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.