@Test
	public void test3() {
		xmlReader.setContentHandler(new DefaultHandler() {
			List<Book> books = new ArrayList<>();
			private String currentQName;
			private Book currentBook;

			@Override
			public void startElement(String uri, String localName,
					String qName, Attributes atts) throws SAXException {
				currentQName = qName;
				switch (qName) {
				case "book":
					currentBook = new Book();
					if (atts.getLength() > 0) {
						currentBook.setId(Integer.valueOf(atts.getValue(0)));
					}
					break;
				default:
					break;
				}
			}

			@Override
			public void endElement(String uri, String localName, String qName)
					throws SAXException {
				switch (qName) {
				case "book":
					books.add(currentBook);
					break;

				default:
					break;
				}
			}

			@Override
			public void endDocument() throws SAXException {
				System.out.println(books);
			}

			@Override
			public void characters(char[] ch, int start, int length)
					throws SAXException {
				String str = new String(ch, start, length);
				if (str.trim().length() == 0) {
					return;
				}
				switch (currentQName) {
				case "name":
					currentBook.setName(str);
					break;
				case "author":
					currentBook.setAuthor(str);
					break;
				case "price":
					if (str.matches("[0-9\\.]+")) {
						currentBook.setPrice(Float.parseFloat(str));
					}
					break;
				default:
					break;
				}
			}
		});
	}