Ejemplo n.º 1
0
 public Book createBook(Element bookElement, Element bookIndexElement) {
   Book book = new Book(bookElement.text().trim());
   Elements chapterUrlElements = bookIndexElement.select("a");
   for (Element link : chapterUrlElements) {
     String chapterPage = link.attr("href");
     int chapterID = Integer.parseInt(link.text());
     Chapter chapter = createChapter(chapterID, chapterPage);
     book.addChapter(chapter);
   }
   return book;
 }
Ejemplo n.º 2
0
 public void printTestamentSummary(Testament testament) {
   System.out.println("  " + testament);
   for (Book book : testament.getBooks()) {
     System.out.println("    " + book);
     for (Chapter chapter : book.getChapters()) {
       int chapterID = chapter.getID();
       int sectionID = chapter.getLastSectionID();
       System.out.println(
           "      "
               + chapterID
               + ":"
               + sectionID
               + " "
               + chapter.getSection(chapter.getLastSectionID()));
     }
   }
 }