Map map = new LinkedHashMap();
List<Book> list = new ArrayList<Book>();
for ( Iterator i = root.elementIterator( "book" ); i.hasNext(); ) {
Book book=new Book();
Element foo = (Element) i.next();
book.setBookId(foo.attributeValue("bookId"));
book.setBookName(foo.attributeValue("bookName"));
Double price =Double.parseDouble(foo.attributeValue("bookPrice"));
book.setBookPrice(price);
book.setBookAuthor(foo.attributeValue("bookAuthor"));
book.setDescription(foo.attributeValue("description"));
map.put(i,book);
}
return map;
List<Book> list = new ArrayList<Book>();
for ( Iterator i = root.elementIterator( "book" ); i.hasNext(); ) {
Book book=new Book();
Element foo = (Element) i.next();
book.setBookId(foo.attributeValue("bookId"));
book.setBookName(foo.attributeValue("bookName"));
Double price =Double.parseDouble(foo.attributeValue("bookPrice"));
book.setBookPrice(price);
book.setBookAuthor(foo.attributeValue("bookAuthor"));
book.setDescription(foo.attributeValue("description"));
map.put(i,book);
}
return map;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货