Here is my dilemma. I need to replace the default node -- ROW -- that you get with SYS_XMLGEN.
I wrote a query with the XMLFORMAT function as suggested by the gurus in this forum. However, the node that I am substituting must also have an attribute defined and this is where I am stuck. How can I replace the ROW node with my custom node together with my attribute?
Please help.
Here is my query:
SELECT SYS_XMLGEN(
XMLELEMENT ("contribution",
XMLAGG(
XMLFOREST('Service' AS "load_type",
'zone' AS "zone",
'area' AS "area"
)
)
),
XMLFORMAT('ecapacity', NULL, NULL, NULL, NULL,'<!DOCTYPE ecapacity SYSTEM "ecapacity.dtd">')
)
FROM dual
Here is my output:
<?xml version="1.0"?>
<!DOCTYPE ecapacity SYSTEM "ecapacity.dtd">
<ecapacity>
<contribution>
<load_type>Service</load_type>
<zone>zone</zone>
<area>area</area>
</contribution>
</ecapacity>
However, my need is that the <ecapacity> element must look like this with attributes:
<ecapacity xmlns="http://www.rasa.com/ecapacity">
instead of
as it currently is.
Please help.