Creating an XML document in PL / SQL from Oracle tables

I need to create XML documents in PL / SQL from some tables in Oracle. I have never done this before, and I found there a few basic ways to do this:

  • xmldom API
  • xml functions (such as xmlelement, xmlagg, xmlroot)
  • Dbms_xmlgen functions

There are 65 tables that will be referenced by the creation of a single document, and I will have to check the output on xsd. Documents will be generated in a package (and not on demand) - I do not know if this matters. Using Oracle 10g.

At first I was inclined to use the xmldom package because it looked more flexible, but I find it difficult to find good examples or documentation for it, while the xml functions look better documented and, as a rule, more popular. Is there a reason for this?

What approach is usually recommended to people for this type of task?

+5
source share
4 answers

In my experience, DBMS_XMLGEN is good for quickly and dirtyly converting data to xml, but I never liked it because you need to pass SQL as a string. In addition, your control over element names and the ROWSET / ROW structure is severely limited.

The XML functions are extremely convenient, and my favorite, if you are dealing with relatively simple structures. For example, when you fall into several levels of XMLAgg, I find that it quickly goes into confusion.

XMLDOM - XML, . , Java DOM, DOMNode, PL/SQL , DOMElement DOMNode .. , .

+5

, Oracle XML, DBMS_XMLDOC .

( , pl/sql). Google Code Search, - . DBMS_XMLDOM, , .

, :
http://www.liberidu.com/blog/?p=365
http://www.liberidu.com/blog/?p=369

XML Java.

+2

xml (XMLElement, XMLForest ..), XSD. XSD , .

, , , DBMS_XMLGEN DOM.

+2

:

http://asktom.oracle.com/pls/asktom/f?p=100:11:59::::P11_QUESTION_ID:4980337843276

Also, if you search for “Sean Dillon” on AskTom, you will get a good collection of articles describing various problems and solutions using XML in Oracle.

+2
source

All Articles