aspose file tools*
The moose likes XML and Related Technologies and the fly likes Appending elements to XML dynamically using SAX parser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Appending elements to XML dynamically using SAX parser" Watch "Appending elements to XML dynamically using SAX parser" New topic
Author

Appending elements to XML dynamically using SAX parser

Dhanasekar Thangavelu
Greenhorn

Joined: Jul 05, 2007
Posts: 3
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

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
Dhanasekar Thangavelu
Greenhorn

Joined: Jul 05, 2007
Posts: 3
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Appending elements to XML dynamically using SAX parser