Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Appending elements to XML dynamically using SAX parser

 
Dhanasekar Thangavelu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I want my data objects which is in a collection to be iterated such that i want to marshall only one object at a time and written to XML .So when i go to the second element in the collection, i wana append to the existing xml.So please let me know how to do it.I'm using Castor for XML-data binding and SAX parser


Thanks in advance !!
Dhanasekar
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Appending elements to XML dynamically using SAX parser Using SAX only you cannot append element to an XML document.

I want my data objects which is in a collection to be iterated such that i want to marshall only one object at a time and written to XML .So when i go to the second element in the collection, i wana append to the existing xml.

You can do this using castor.Castor would marshall the object graph you give as input to castor.
 
Dhanasekar Thangavelu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul,

If i'm correct , you wana try me with going for the collections for marshalling the objects to the XML.If so the issue is volume of data i'm facing to marshal using castor since i want to make sure whatever records written to xml till that point should'nt be lost whenever some exception breaks out...
Let me knnow your concerns...


Originally posted by Rahul Bhattacharjee:
Appending elements to XML dynamically using SAX parser Using SAX only you cannot append element to an XML document.

I want my data objects which is in a collection to be iterated such that i want to marshall only one object at a time and written to XML .So when i go to the second element in the collection, i wana append to the existing xml.

You can do this using castor.Castor would marshall the object graph you give as input to castor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic