List of usage examples for java.util Calendar.Round.Match toString
@Override
public String toString()
From source file:com.quangphuong.crawler.util.Crawler.java
@Scheduled(fixedDelay = 604800000) public void schedule2() { WebClient client = webClient;/*from w ww . j ava2 s . c o m*/ int[] calType = { 1, 10, 11, 22, 36, 37, 93 }; for (int k : calType) { try { HtmlPage page = client.getPage(AppConstant.calendarPage + k); List<DomElement> els = (List<DomElement>) page.getByXPath(AppConstant.rounds); List<Calendar.Round> rounds = new ArrayList<Calendar.Round>(); for (int i = 1; i < els.size() - 3; i++) { DomElement tmp = els.get(i); DomNode parent = tmp.getParentNode().getParentNode().getParentNode().getParentNode(); List<DomElement> trs = (List<DomElement>) parent.getByXPath("tbody/tr"); String date = ""; List<Calendar.Round.Match> matches = new ArrayList<Calendar.Round.Match>(); for (int j = 1; j < trs.size() - 1; j++) { DomElement tr = trs.get(j); HtmlElement tmp2 = tr.getFirstByXPath("td"); if (tmp2.hasAttribute("bgcolor")) { date = tr.getTextContent().trim(); } else { try { DomElement td = tr.getFirstByXPath("td[1]/a"); if (td == null) { td = tr.getFirstByXPath("td[1]"); } String teams = td.getTextContent().trim(); String link = td.getAttribute("href"); td = tr.getFirstByXPath("td[2]/a/img"); String logoTeam1 = td.getAttribute("src"); td = tr.getFirstByXPath("td[3]"); String score = td.getTextContent().trim(); td = tr.getFirstByXPath("td[4]/a/img"); String logoTeam2 = td.getAttribute("src"); Calendar.Round.Match match = new Calendar.Round.Match(date, link, teams, logoTeam1, logoTeam2, score); match.toString(); matches.add(match); } catch (Exception e) { e.printStackTrace(); } } } rounds.add(new Calendar.Round(matches, i)); } Calendar calendar = new Calendar(rounds, k); xMLUtil.marshallUtil(intToCalendar(k), calendar); } catch (Exception e) { e.printStackTrace(); } finally { client.close(); } } }