private Book extractViewValues(Book book) {
   if (book == null) {
     book = new Book();
   }
   book.setAuthor(txtFieldAuthor.getText());
   book.setName(txtFieldTitle.getText());
   book.setPublisher(txtFieldPublisher.getText());
   book.setShelf((Shelf) comboShelf.getSelectedItem());
   return book;
 }
 private static void loadBooksFromXml(Library library, DocumentBuilder builder, File file)
     throws SAXException, IOException {
   Document doc2 = builder.parse(file);
   NodeList titles = doc2.getElementsByTagName("title");
   for (int i = 0; i < titles.getLength(); i++) {
     Node title = titles.item(i);
     Book b = library.createAndAddBook(getTextContentOf(title, "name"));
     b.setAuthor(getTextContentOf(title, "author"));
     b.setPublisher(getTextContentOf(title, "publisher"));
     b.setShelf(Shelf.A1);
   }
 }