Package org.jsoup.select

Examples of org.jsoup.select.Elements


        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group date");
        assertThat(formInputElement.attr("id"), equalTo("dateOfBirth"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"dateOfBirth"));
    }
View Full Code Here


        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group time");
        assertThat(formInputElement.attr("id"), equalTo("alarmTime"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"alarmTime"));
    }
View Full Code Here

        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group datetime");
        assertThat(formInputElement.attr("id"), equalTo("auditTimestamp"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"auditTimestamp"));
    }
View Full Code Here

        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group input");
        assertThat(formInputElement.attr("id"), equalTo("optForMail"));
        assertThat(formInputElement.attr("type"), equalTo("checkbox"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"optForMail"));
    }
View Full Code Here

        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements nToManyWidgetElement = html.select("div.form-group > div.col-sm-10");
        assertThat(nToManyWidgetElement, notNullValue());

        Elements selectElement = nToManyWidgetElement.select(" > select");
        assertThat(selectElement.attr("id"), equalTo(oneToManyProperty));
        assertThat(selectElement.attr("multiple"), notNullValue());
        assertThat(selectElement.attr("ng-model"), equalTo(oneToManyProperty+"Selection"));
        String collectionElement = oneToManyProperty.substring(0, 1);
        String optionsExpression = collectionElement +".text for "+ collectionElement +" in " + oneToManyProperty + "SelectionList";
        assertThat(selectElement.attr("ng-options"), equalTo(optionsExpression));
    }
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

    }
    return accountList;
  }

  private Account addAccountDetails(Account pAccount, Document pDocument) {
    Elements vAccountDetails = pDocument
        .select("strong:contains(Saldo och transaktioner) ~ table")
        .first().select("tr td:last-child");
    String vAccountType = vAccountDetails.first().text();
    String vBalance = vAccountDetails.last().text();
    pAccount.setName(vAccountType);
    pAccount.setCurrency(Currency.getInstance("SEK"));
    BigDecimal balance = new BigDecimal(vBalance.replaceAll("[^\\d]", ""));
    pAccount.setBalance(balance);
    pAccount.setAvailable(balance);
View Full Code Here

  }

  private List<Transaction> parseTransactions(String pResponse) {
    List<Transaction> vTransactions = new ArrayList<Transaction>();
    Document doc = Jsoup.parse(pResponse);
    Elements vTransactionElements =
        doc.getElementById("balanceForm:transactionPostList").select("tbody tr");

    for (Element element : vTransactionElements) {
      Transaction vTransaction = new Transaction();
      Elements vTransactionElement = element.select("td");

      vTransaction.setAmount(new BigDecimal(vTransactionElement.get(1).text()
          .replaceAll("[^\\d-]", "")));
      vTransaction.setDescription(vTransactionElement.get(2).text());
      if (!vTransaction.hasDescription()) {
        vTransaction
            .setDescription(vTransaction.getAmount().compareTo(BigDecimal.ZERO) > 0 ? "Insättning"
                : "Uttag");
      }
      vTransaction.setCurrency(Currency.getInstance("SEK"));

      vTransaction.setTransactionDate(new LocalDate(vTransactionElement.first().text()));
      vTransactions.add(vTransaction);
    }
    return vTransactions;
  }
View Full Code Here

   
    Set<String> tagSet = new HashSet<String>();
    for(String tag : tags)
      tagSet.add(tag.toLowerCase());
    filterElementsByTag(results, element, tagSet);
    return new Elements(results);
  }
View Full Code Here

    return findFirstByTag(element, tag.split("/"), 0);
  }
 
  private static Element findFirstByTag(Element current, String [] tags, int index) {
    if(index < tags.length) {
      Elements elements = current.getElementsByTag(tags[index]);
      for(Element element : elements) {
        Element result = findFirstByTag(element, tags, index + 1);
        if(result != null)
          return result;
      }
View Full Code Here

TOP

Related Classes of org.jsoup.select.Elements

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.