Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About XML parser

 
lei jiong
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, our team is doing a JAVA project which needs to use XML to store all the data. In this project, we need not only to read data from XML files, but also write to XML files. In addtion, some of XML files are very big, which might have 1000 rows, more than 30000 nodes. Currently, we are using DOM to parse XML files, but it takes too long to get data, and some times, out of memory. We have thinked about JDOM, but it also has to build the entire tree to the memory, which might cause the memory problem. And SAX can not update the data.
Do some body have good suggetions for us to improve our project?
Thanks!
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lei jiong:
some XML files are very big, which might have 1000 rows, more than 30000 nodes.

Just wondering why you went for XML to carry such big data instead of using standard database approach.
In any case, please check data binding tools like Castor or Jbind, which is capable of processing large files in an efficient way.
castor: http://www-106.ibm.com/developerworks/xml/library/x-bindcastor/
jbind:http://java.sun.com/xml/jaxp/dist/1.0.1/docs/binding/DataBinding.html
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With respect to your statement:
And SAX can not update the data.

Exactly what kind of update do you want to do?
You can use SAX events to write a new database XML file on the fly. If your update changes are simple, such as changing a few attributes or the contents of an element, they can also be done on the fly. The advantage being that the memory requirement will be much less and speed greater.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic