title: Generate XML document in PL/SQL from Oracle tables
body: <p>I have to generate XML documents in PL/SQL from some tables in Oracle. I have never done this before, and I have found there seem to be a few main ways to do it:</p>
  
  <ul>
  <li>xmldom API</li>
  <li>xml functions (such as xmlelement, xmlagg, xmlroot)</li>
  <li>dbms_xmlgen functions</li>
  </ul>
  
  <p>There are 65 tables that will be referenced to generate a single document, and I will have to validate the output against an xsd. The documents will be generated in a batch (rather than on-demand) - I don't know if that makes a difference. Using Oracle 10g.</p>
  
  <p>I was initially leaning towards using the xmldom package as it looked more flexible, but I am having trouble finding good examples or documentation for it, whereas the xml functions seem better documented and generally more popular. Is there a reason for this?</p>
  
  <p>What approach do people generally recommend for this type of task?</p>