Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Writing large chunk of data in XML

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic