Create xml file and write data in to it:
Hi All,
I have a small requirement here.....
I have a java program which reads a xml file.
Now i have stored the contents of that file in to a java object.
I want a sample code now which would take theabove mentioned java object as an input ,create a xml file and write these entries in to the file.
Can anyone help me in this?
Your help would be appreciated.
Thanks in advance.
vrkr
[438 byte] By [
vrkra] at [2007-11-27 1:30:09]

# 1
Hmmm. There is nothing special about an XML file to any other file. The data is simply formatted in a certain way. So to write an XML file, it is no different to writing any other form of file in Java (assuming you know the structure of the xml format to write - which you should)
If you don't know how to write files using Java I would suggest using the Java Tutorial found on java.sun.com and do some reading up about I/O since this is fairly fundamental.
http://java.sun.com/docs/books/tutorial/
http://java.sun.com/docs/books/tutorial/essential/io/index.html