I have a large XML file that consists of relatively fixed size items i.e.
<rootElem>
<item>...</item>
<item>...</item>
<item>...</item>
<rootElem>
The item elements are relatively shallow and typically rather small ( <100 KB), but there may be a lot of them (hundreds of thousands). The items are completely independent of each other.
How could I process the file efficiently in Java? I can't read the whole file in as DOM, and I don't like to use SAX because the code gets rather complex. I'd like to avoid splitting the file to smaller pieces.
Optimal would be if I could obtain each item element, one at a time, as a separate DOM document, that I could process using tools like JAXB. Basically I just want to loop once over all the items.
I would think that this is a rather common problem.