XML Data Binding with Castor
Subject:   How to convert efficienty XML big files
Date:   2006-02-19 02:50:03
From:   davidlealvalmana
I have read a lot about Castor Project, but I have no found where to find a example for parsing really big XML into java objects.

I have a typical file like this:

<book> </book>
<book> </book>
<book> </book>

if the file is big enough I can't load the whole book store at once, my idea is to take one by one each <book> information (or to limit the number of book elements to take for avoiding overflow), then for example store into database and then to take the next one, so I want to parse book events, process it and the to go to the next one. ┐How can we do it with castor?

With the solution of this article, for a big file we are going to get an overflow for sure.

Thanks in advance,

David Leal

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • How to convert efficienty XML big files
    2006-02-26 13:34:37  glenpepicelli [View]

    Check out the new StAX API (JSR 173). There is an implemenation at

    This API will let you read an XML file without holding it in memory. So you may process it or load it into a database even if it's way too big to fit into memory.

    StAX isn't automatic like Castor but it is still very easy. You should be able to write your first parser in less than a day.