Re: Getting well-formed XML using SQL

I presume that you are testing this on Oracle 9204 or later as I believe
the same code on 9202
would give you the nested output. This change in behaviour was
deliberately introduced at 9202
for some performance reasons.

If a formatted document is required, use DBMS_XMLGEN.getXML instead as
the following
code sample illustrates :