Oracle sql query to xml
An easy way to convert SQL directly to XML, for example:

SQL&gt; select dbms_xmlgen.getxml('select * from hr.employees where employee_id = 100') 
       as xml from dual;

XML
--------------------------------------------------------------------------------
&lt;?xml version="1.0"?&gt;
&lt;ROWSET&gt;
 &lt;ROW&gt;
  &lt;EMPLOYEE_ID&gt;100&lt;/EMPLOYEE_ID&gt;
  &lt;FIRST_NAME&gt;Steven&lt;/FIRST_NAME&gt;
  &lt;LAST_NAME&gt;King&lt;/LAST_NAME&gt;
  &lt;EMAIL&gt;SKING&lt;/EMAIL&gt;
  &lt;PHONE_NUMBER&gt;515.123.4567&lt;/PHONE_NUMBER&gt;
  &lt;HIRE_DATE&gt;17-JUN-03&lt;/HIRE_DATE&gt;
  &lt;JOB_ID&gt;AD_PRES&lt;/JOB_ID&gt;
  &lt;SALARY&gt;24000&lt;/SALARY&gt;
  &lt;DEPARTMENT_ID&gt;90&lt;/DEPARTMENT_ID&gt;
 &lt;/ROW&gt;
&lt;/ROWSET&gt;


If you have a fixed format of your XML, you can describe it in XSLT and use XMLTRANSFORM to take care of the rest.