Package nl.siegmann.epublib.domain

Examples of nl.siegmann.epublib.domain.Author


  private static List<Author> readAuthors(String authorTag, Element metadataElement) {
    NodeList elements = metadataElement.getElementsByTagNameNS(NAMESPACE_DUBLIN_CORE, authorTag);
    List<Author> result = new ArrayList<Author>(elements.getLength());
    for(int i = 0; i < elements.getLength(); i++) {
      Element authorElement = (Element) elements.item(i);
      Author author = createAuthor(authorElement);
      if (author != null) {
        result.add(author);
      }
    }
    return result;
View Full Code Here


 
      // Set the title
      book.getMetadata().addTitle("Epublib test book 1");
     
      // Add an Author
      book.getMetadata().addAuthor(new Author("Joe", "Tester"));
 
      // Set cover image
      book.setCoverImage(new InputStreamResource(Simple1.class.getResourceAsStream("/book1/cover.png"), MediatypeService.PNG));
     
      // Add Chapter 1
View Full Code Here

    String authorString = DOMUtil.getTextChildrenContent(authorElement);
    if (StringUtil.isBlank(authorString)) {
      return null;
    }
    int spacePos = authorString.lastIndexOf(' ');
    Author result;
    if(spacePos < 0) {
      result = new Author(authorString);
    } else {
      result = new Author(authorString.substring(0, spacePos), authorString.substring(spacePos + 1));
    }
    result.setRole(authorElement.getAttributeNS(NAMESPACE_OPF, OPFAttributes.role));
    return result;
  }
View Full Code Here

      return;
    }
    List<Author> authorObjects = new ArrayList<Author>();
    for(String authorName: authorNames) {
      String[] authorNameParts = authorName.split(",");
      Author authorObject = null;
      if(authorNameParts.length > 1) {
        authorObject = new Author(authorNameParts[1], authorNameParts[0]);
      } else if(authorNameParts.length > 0) {
        authorObject = new Author(authorNameParts[0]);
      }
      authorObjects.add(authorObject);
    }
    book.getMetadata().setAuthors(authorObjects);
  }
View Full Code Here

            // Set the title
            book.getMetadata().addTitle("Epublib test book 1");

            // Add an Author
            book.getMetadata().addAuthor(new Author("Joe", "Tester"));

            // Set cover image
            book.setCoverImage(new Resource(Simple1.class.getResourceAsStream("/book1/test_cover.png"), "cover.png"));

            // Add Chapter 1
View Full Code Here

   *
   */
  public void testWritingBookWithCoverWithNullId() throws FileNotFoundException, IOException {
    Book book = new Book();
      book.getMetadata().addTitle("Epub test book 1");
      book.getMetadata().addAuthor(new Author("Joe", "Tester"));
      InputStream is = this.getClass().getResourceAsStream("/book1/cover.png");
      book.setCoverImage(new Resource(is, "cover.png"));
      // Add Chapter 1
      InputStream is1 = this.getClass().getResourceAsStream("/book1/chapter1.html");
      book.addSection("Introduction", new Resource(is1, "chapter1.html"));
View Full Code Here

   
    book.getMetadata().addTitle("Epublib test book 1");
    book.getMetadata().addTitle("test2");
   
    book.getMetadata().addIdentifier(new Identifier(Identifier.Scheme.ISBN, "987654321"));
    book.getMetadata().addAuthor(new Author("Joe", "Tester"));
    book.setCoverPage(new Resource(this.getClass().getResourceAsStream("/book1/cover.html"), "cover.html"));
    book.setCoverImage(new Resource(this.getClass().getResourceAsStream("/book1/cover.png"), "cover.png"));
    book.addSection("Chapter 1", new Resource(this.getClass().getResourceAsStream("/book1/chapter1.html"), "chapter1.html"));
    book.addResource(new Resource(this.getClass().getResourceAsStream("/book1/book1.css"), "book1.css"));
    TOCReference chapter2 = book.addSection("Second chapter", new Resource(this.getClass().getResourceAsStream("/book1/chapter2.html"), "chapter2.html"));
View Full Code Here

TOP

Related Classes of nl.siegmann.epublib.domain.Author

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.