Guest User

Untitled

a guest
Apr 19th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <TaskLifetimeList ml-is-active="">
  2. <TaskLifetimes>
  3. <TaskLifetime>...</TaskLifetime>
  4. <TaskLifetime>...</TaskLifetime>
  5. <TaskLifetime>...</TaskLifetime>
  6. <TaskLifetime>
  7. <Comments>
  8. <![CDATA[
  9. подготовить ]]>
  10. </Comments>
  11. <IsPublic>True</IsPublic>
  12. <Date>19.04.2018 13:00:19</Date>
  13. <EditorId>9017</EditorId>
  14. <Editor>ААААААААААААА</Editor>
  15. <Executors>ВВВВВВВВВВ</Executors>
  16. <ExecutorsGroup>БББББББББББ</ExecutorsGroup>
  17. <Participants>АААААА</Participants>
  18. <StatusId>35</StatusId>
  19. </TaskLifetime>
  20. <TaskLifetime>...</TaskLifetime>
  21. <TaskLifetime>...</TaskLifetime>
  22. </TaskLifetimes>
  23. <Paginator>...</Paginator>
  24. </TaskLifetimeList>
  25.  
  26. public List<Date> getDates() throws IOException, ParseException {
  27. SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
  28. Document document = Jsoup.connect("some-url").get();
  29.  
  30. Elements elements = document.select("TaskLifetimeList TaskLifetimes TaskLifetime");
  31.  
  32. List<Date> dates = new ArrayList<>();
  33. for (Element item : elements) {
  34. if (item.select("ExecutorsGroup").size() > 0) {
  35. String stringDate = item.selectFirst("Date").text();
  36. dates.add(format.parse(stringDate));
  37. }
  38. }
  39.  
  40. return dates;
  41. }
Add Comment
Please, Sign In to add comment