I have a xml document ~10mb in size. It has relatively simple structure but has alot of binary data in it. I need to get data from it and save it in db. Tried jaxb metro - works really slow. I am currently trying jibx for this but unmarshalling a couple of xml docs uses all jvm memory - heap space error - db gets corrupted. Maybe i should use something else for reading xmls? please, give some advice.
Edit My xml represents sort of a message, with information like "to", "from", etc, just strings ints and dates. Biggest part are attached files in byte[], each attachment in its own element. Maybe its possible to load those one by one? I really don't what i should do.
You could use stax, it's a good answer for quickly ingesting/generating xml. It's part of jvm now, very simple to use. You will like it :-).
The thing is that you manage clearly each element and attibute as you are reading the file. You do a loop on the elements (start/end) and get easy access to their attributes. It gives you precision on what you want to do. Also not everything is loaded in memory as in DOM.
There are a lot of tutorials online. Here is the first page about it I found on the oracle web site. http://docs.oracle.com/javaee/5/tutorial/doc/bnbem.html