How to add Data to XML File ?
1 posts in topic
Flat View  Flat View

Posted By:   pradeep_kharvi
Posted On:   Sunday, December 23, 2001 11:07 PM

Hi Everyone,

i have a very simple query

i am storing my data in xml file say data.xml

when next time i have to add a data to the same xml file , how can i append a new data to the existing XML file ?

guide me

pradeep kharvi

Re: How to add Data to XML File ?

Posted By:   Bozidar_Dangubic  
Posted On:   Monday, December 24, 2001 05:49 AM

parse the file into DOM document. once you have a Document with all the data from the file, create new elements (Element newElement = document.createElement("New Data")), add attributes to the new elements (newElement.setAttribute("persisted","true")) and associate a new element with the document (documentRootNode.appendChild(newElement)). use simple DOM API to append any new elements, alter current elements, delete current elements, ... it is very simple.
About | Sitemap | Contact