List of usage examples for org.jsoup.nodes Element childNodeSize
@Override public int childNodeSize()
From source file:mergedoc.core.APIDocument.java
/** * Javadoc ? ??????//from w w w .j a va2 s.c o m * @param className ?? * @param context * @param comment */ private void parseCommonTag(String className, Element element, Comment comment) { Elements dts = element.select("dl dt"); for (Element dt : dts) { String dtText = dt.text(); if (dtText.contains("")) { Elements aTags = dt.nextElementSibling().select("a:has(code)"); for (Element a : aTags) { String url = a.attr("href"); String ref; if (a.childNodeSize() != 1) { ref = aTags.outerHtml(); } else { ref = formatClassName(className, url); ref = FastStringUtils.replace(ref, "%28", "("); ref = FastStringUtils.replace(ref, "%29", ")"); Pattern methodRefPat = PatternCache.getPattern("-(.*)-$"); Matcher methodRefMat = methodRefPat.matcher(ref); if (methodRefMat.find()) { ref = FastStringUtils.replaceAll(ref, "-(.*)-$", "($1)"); // for Java8 ref = FastStringUtils.replace(ref, "-", ","); // for Java8 ref = FastStringUtils.replace(ref, ":A", "[]"); // for Java8 } } comment.addSee(ref); } } else if (dtText.contains("???:")) { comment.addSince(dt.nextElementSibling().text()); } } }
From source file:com.liato.bankdroid.banking.banks.AbsIkanoPartner.java
@Override public void update() throws BankException, LoginException, BankChoiceException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); }/*from w ww . j av a2 s. c om*/ urlopen = login(); Document d = Jsoup.parse(response); Element element = d.select("#primary-nav > li:eq(1) > a").first(); if (element != null && element.attr("href") != null) { String myAccountUrl = element.attr("href"); try { response = urlopen.open("https://partner.ikanobank.se/" + myAccountUrl); d = Jsoup.parse(response); Elements es = d.select("#CustomerAccountInformationSpan > span > span"); int accId = 0; for (Element el : es) { Element name = el.select("> span > span:eq(0)").first(); Element balance = el.select("> span:eq(1)").first(); Element currency = el.select("> span:eq(2)").first(); if (name != null && balance != null && currency != null) { Account account = new Account(name.text().trim(), Helpers.parseBalance(balance.text()), Integer.toString(accId)); account.setCurrency(Helpers.parseCurrency(currency.text(), "SEK")); if (accId > 0) { account.setAliasfor("0"); } accounts.add(account); accId++; } } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } // Use the amount from "Kvar att handla fr" which should be the // last account in the list. this.balance = accounts.get(accounts.size() - 1).getBalance(); ArrayList<Transaction> transactions = new ArrayList<Transaction>(); es = d.select("#ShowCustomerTransactionPurchasesInformationDiv table tr:has(td)"); for (Element el : es) { if (el.childNodeSize() == 6) { Transaction transaction = new Transaction(el.child(0).text().trim(), el.child(1).text().trim(), Helpers.parseBalance(el.child(2).text())); transaction.setCurrency(Helpers.parseCurrency(el.child(3).text().trim(), "SEK")); transactions.add(transaction); } } accounts.get(0).setTransactions(transactions); } catch (ClientProtocolException e) { throw new BankException(e.getMessage()); } catch (IOException e) { throw new BankException(e.getMessage()); } } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }