How to deserialize multiple object with xStream



i try to read multiple object with xStream


This is my XML file



<book>
<title>abc</title>
<author>A</author>
<pagesCount>0</pagesCount>
</book><book>
<title>qwe</title>
<author>B</author>
<pagesCount>0</pagesCount>
</book><book>
<title>zxc</title>
<author>C</author>
<pagesCount>0</pagesCount>
</book>


With this code I can get onlY the first book, can you tell me how to read a code, with which i am able to read all objects(books)



XStream xstream = new XStream();
xstream.processAnnotations(Book.class);
Book a = (Book)xstream.fromXML(new File("a.xml"));

No comments:

Post a Comment