aspose file tools*
The moose likes XML and Related Technologies and the fly likes Writing large chunk of data in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Writing large chunk of data in XML" Watch "Writing large chunk of data in XML" New topic
Author

Writing large chunk of data in XML

Saurabh Agrawal
Ranch Hand

Joined: Oct 07, 2003
Posts: 244
Hi everyone,

I am writing an XML by iterating over the java objects (which can be as large as 3000 in number and quite bulky).when i am performing write opeation for one object at a time, in total there would be 3000 write operations.

This slows done my speed considerably.I cheked the method using profiler and it consumes lots of time(as long as 1 hour) which is quite a lot.I checked and there are no hardware issues.

What can be done in this case.Does anyone have any idea of how thsi write operation can be fastened up.

I was thinking to buffer everything and then write it in one shot, but it has some limitations like.. size of data is too large to buffer , secondly on account of some error due to one object all write operation would fail which we dont wat.

Any suggestions in this regard would be of great help.
Thanks in advance,
Saurabh


Success is not doing extraordinary things but doing ordinary things extraordinarily well.
chetan anurag
Greenhorn

Joined: Dec 08, 2005
Posts: 6
USE DOCUMENT OBJECT OF JDOM TO STORE THE XML OBJECT AND KEEP ADDING ELEMENTS TO IT, 3000 ELEMENTS IS NOT A BIG NUMBER AND THEN WRITE IT DOWN TO A PHYSICAL FILE. UPTO 200 MB I HAVE WORKED WITH.


chetan
Saurabh Agrawal
Ranch Hand

Joined: Oct 07, 2003
Posts: 244
Originally posted by chetan anurag:
USE DOCUMENT OBJECT OF JDOM TO STORE THE XML OBJECT AND KEEP ADDING ELEMENTS TO IT, 3000 ELEMENTS IS NOT A BIG NUMBER AND THEN WRITE IT DOWN TO A PHYSICAL FILE. UPTO 200 MB I HAVE WORKED WITH.


Thats a good idea nurag but JDOM wont allow 2 way binding i.e. java object to xml and vice vers.Secondly, its a DOM based implementation which is supposed to be slower than SAX based like CASTOR.

So still will you ask me to use JDOM ? Can you highlight some difference between CASTOR and JDOM or prove JDOM is better than CASTOR.
Performance is also a factor for me.

Please let me know.
Thanks in advance,
Saurabh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing large chunk of data in XML
 
Similar Threads
XML Parsing using SAX/Digester
Is it better to write each line to a file or wait and write whole string
buffer size in page directive
Writing to file
IO Performance