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.
If you are using the Oracle Database you can use the following pacakage.
select dbms_xmlgen.getxml('select sysdate from dual',0)xml from dual;
In the place of the 'select sysdate from dual' you can specify your query.
The data will automatically be generated in XML. You can also use the DOM Parser in java if this doesn't suit your requirement.
They say you have to be the first, the best or different. I say, is it too much to ask for all three.
Joined: Jun 23, 2008
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.
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?