This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Parsing huge XML file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Parsing huge XML file" Watch "Parsing huge XML file" New topic

Parsing huge XML file

Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Hi All
I have a requirement to read ,write and modify, huge XML documents whose size may be several MBs or a couple of GBs too. Is there an efficient way of doing this. I think placing whole of it 'in memory' like in JDOM document is surely going to lead to 'Out of memory'. Any help is greatly appreciated.
Satya Deep

Thanks and Regards
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12756
With huge files, as you said, the DOM approach will not fit in memory so you are looking at using an event processing style like SAX.

Depending on your exact problem you may find the ServingXML toolkit will help.

The SmallX toolkit is another possibility.

By all means read Harold's free online chapter on SAX filters.

Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Thanks Bill!
jQuery in Action, 2nd edition
subject: Parsing huge XML file
Similar Threads
Database View to CSV and XML
Huge XML
Validating XML file beforehand using SAX
Reading from XML file
copy xml string into a dom tree