Java/XML: Good "Stream-based" Alternative to JAXB?
Posted
by Jan
on Stack Overflow
See other posts from Stack Overflow
or by Jan
Published on 2010-04-06T16:37:10Z
Indexed on
2010/04/06
20:33 UTC
Read the original article
Hit count: 310
Hello Experts,
JAXB makes working with XML so much easier, but I have currently a big problem, that the documents I have to process are too large for an in memory unmarshalling that JAXB does. The data can be up to 4GB per document.
The datastructure I will have to process is very simple and flat: With a root element and millions of “elements”…
<root>
<element>
<sub>foo</sub>
</element>
<element>
<sub>foo</sub>
</element>
</root>
May questions are:
Does JAXB maybe somehow support unmarshalling in a “streambased” way, that does not require to build the whole objecttree in memory but rather gives me some kind of “Iterator” to the elements, element by element? (Maybe I just missed that somehow…)
If not what are your proposals for an good alternative with a a. “flat learningcurve, ideally very similar to JAXB b. AND VERY IMPORTANT: Ideally with the possibility / tool for the generation of the unarshaller code from an XSD file OR annotated Java Class
3.(I have searched SO and those to library that ended up on my “watchlist” (without comparing them closer) were Apache XML Beans and Xstream… What other libraries are maybe even better for the purpose and what are the disadvantages, adavangaes…
Thank you very much!!! Jan
© Stack Overflow or respective owner