File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Best way to read XML data and store in List<List<Object>> using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Best way to read XML data and store in List<List<Object>> using Java" Watch "Best way to read XML data and store in List<List<Object>> using Java" New topic
Author

Best way to read XML data and store in List<List<Object>> using Java

Gaurav Kr. Arora
Ranch Hand

Joined: Feb 20, 2011
Posts: 37
Hi,

I have to read XML data (big XML file) and store in List<List<Object>> using Java APIs. I am familiar with DOM and SAX parsers. Have heard of JAXB technique.

Could you please let me know the best way to do it?

If there is any other way apart from the ones listed above, please suggest.

Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
1. Exactly what kind of values are you extracting from the XML? Complex structure or simple strings...
2. Do you already have some Java objects that need to be populated with data from the XML?
3. What do you need to do with this List after the data is stored?
4. How large is the XML document roughly?

Bill
Gaurav Kr. Arora
Ranch Hand

Joined: Feb 20, 2011
Posts: 37
1. Exactly what kind of values are you extracting from the XML? Complex structure or simple strings... Simple strings
2. Do you already have some Java objects that need to be populated with data from the XML? No, we have to create List<List<Object>>
3. What do you need to do with this List after the data is stored? Some validations based on rules.We will be iterating through List<List<Object>> and verifying if data is in correct format or not.
4. How large is the XML document roughly? Around 40 mb

Thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Extracting Strings from a simple XML structure sounds like you could use SAX or StaX parsing, which avoids creating a big DOM in memory and will be surprisingly fast.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way to read XML data and store in List<List<Object>> using Java
 
Similar Threads
Using JDOM lib for parssing XML and writing out XML according to a DTD
Facade design pattern in web services
I need a recommendation
Java objects to XML, possibly using JAXB
whats the best way ?