There are several APIs in Java for working with XML.
Unfortunately, the standard Java APIs for working with XML, in the package javax.xml and subpackages, are not the easiest and best to use in many cases. The standard APIs seem to be more focused on parsing XML and are not very good at outputting XML.
There are many alternatives, such as XOM (which XML guru Michael Kay said good things about on the Devoxx conference where I was recently), JDOM, XStream and many others.
Below given is the code.I am retrive the data from database and trying to export in the XML file.
I didnot get any compilation error.But i dont know why in my code the data is not export in the xml file.
hERE I TRIED WITH FNAME for column.
You don't ever close the output stream. You should do that.
Also, do you only have one record to output? If not, then you are reusing the same file for all records and you are going to end up with one file containing only the last record.
Here's another guess: your ResultSet doesn't contain any records. But this is a simple thing which you could find out for yourself by a little bit of debugging. Have you done any of that? Do you know which lines of code are being executed?