Package org.jsoup.nodes

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


        // get the page parent link (note: usually it's 1st elem, but HTTPD for example has extra links for
        // column
        // sorting
        for (Element element : elements) {
          // if text is same and abs URLs points to same place, we got it
          if (templateParentLink.text().equals(element.text())
              && templateParentLink.absUrl("href").equals(element.absUrl("href"))) {
            return new RemoteDetectionResult(RemoteDetectionOutcome.RECOGNIZED_SHOULD_BE_SCRAPED,
                getTargetedServer(), "Remote is a generated index page of " + getTargetedServer());
          }
        }
View Full Code Here


   * @return inner text of the node.
   */
  private String getPreformattedText(Element oinput) {
    Element el = oinput.clone();
    fixLineBreaks(el);
    return el.text();
  }
 
  // recursively processes the element to replace <br>'s with \n
  private void fixLineBreaks(Element el) {
    for(final Element e : el.children()) {
View Full Code Here

          if (lineNo == 1) {
            lineEl.addClass("firstLine");
          }
         
          final Element lineNumber=lineEl.appendElement("div").attr("class","lineNumberMarker");
          lineNumber.text(lineNo+".");
         
          final Element question = lineEl.appendElement("div").attr("class", "question")
              .attr("contentEditable", "true");
          question.text(qa.question);
          final TokenList strippedAnswer = sp.stripUDF(qa.answer);
View Full Code Here

          final Element lineNumber=lineEl.appendElement("div").attr("class","lineNumberMarker");
          lineNumber.text(lineNo+".");
         
          final Element question = lineEl.appendElement("div").attr("class", "question")
              .attr("contentEditable", "true");
          question.text(qa.question);
          final TokenList strippedAnswer = sp.stripUDF(qa.answer);
          final AnswerType aType = WorksheetServlet.getAnswerType(strippedAnswer);
          if (aType.equals(AnswerType.NORMAL)) {
            lineEl.appendElement("div").attr("class", "equals").text("=");
            lineEl.appendElement("div").attr("class", "answer")
View Full Code Here

        final Element lineEl = worksheetElement.appendElement("div").addClass("line").attr("id", "line" + lineNo);
        if (lineNo == 1) {
          lineEl.addClass("firstLine");
        }
        final Element lineNumber=lineEl.appendElement("div").attr("class","lineNumberMarker");
        lineNumber.text(lineNo+".");
        final Element question = lineEl.appendElement("div").attr("class", "question")
            .attr("contentEditable", "true");
        final Element equals = lineEl.appendElement("div").attr("class", "equals").text("=")
            .attr("style", "display:none;");
        lineEl.appendElement("div").attr("class", "answer").attr("style", "display:none;");
View Full Code Here

        maxWeight = currentWeight;
        bestMatch = entry;
      }
    }

    String bestMatchText = bestMatch.text();
    return bestMatchText;
  }

  /** Prepares document. Currently only stipping unlikely candidates, since from time to time they're getting more score than good ones
   *         especially in cases when major text is short.
View Full Code Here

        assertEquals(HttpStatus.OK, response.getStatusCode());

        Document html = Jsoup.parse(response.getBody());
        Element loginButton = html.select(".body--container form button").first();
        assertThat("No login button found", loginButton, is(notNullValue()));
        assertThat(loginButton.text(), is(equalTo("Sign in with github")));
    }

    @Test
    public void userCanSignOut() throws Exception {
        ResponseEntity<String> response = doGet("/signout");
View Full Code Here

        Document html = Jsoup.parse(response.getResponse().getContentAsString());
        Element alert = html.select(".alert.alert-error").first();

        assertThat("No alert on page", alert, is(notNullValue()));
        assertThat(alert.text(), containsString("You must authenticate and authorize"));
    }

    @Test
    public void doesNotShowErrorAlertWhenNoErrorParameterGiven() throws Exception {
        MvcResult response = mockMvc.perform(get("/signin"))
View Full Code Here

        Element searchInputBox = html.select("ul.results").first();
        assertThat(searchInputBox, is(nullValue()));

        Element message = html.select("#content .warning").first();
        assertThat(message.text(), is(notNullValue()));
    }

    private Document performSearch(String search) throws Exception {
        MvcResult mvcResult = mockMvc.perform(get("/search?q=" + search))
                .andReturn();
View Full Code Here

    Elements elements = jsoupDocument.getElementsByTag("title");
    Element titleElement = elements.first();
    if(titleElement == null)
      return null;
    else
      return titleElement.text();
  }

  @Override
  public void setTitle(String title) {
   
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.