Load XML into memory



I have an XML file that I need to read entirely, and I don't know what use (DOM, SAX or JAXB) I have seen many things on internet but I'm still doubting....


As I need all the data which are in the file, it's a good idea to parse the file for create Java's objects like beans ? Because :


If I use SAX without using beans, I will have to read the file entirely at each time I need a data. And if I use DOM without using beans, I will have to perform request at each time I need a data.


So, firstly, have you got the same opinion ?


Secondly, if I use beans, what do you preconize between DOM, SAX or JAXB and why ?



  • I need to read my file entirely.

  • I don't need to modify my file.

  • My file is small (20Ko).


No comments:

Post a Comment