Home » Developer & Programmer » JDeveloper, Java & XML » XML (9i): How to replace the ROW node with custom node with attributes?
XML (9i): How to replace the ROW node with custom node with attributes? [message #160345] Fri, 24 February 2006 10:02
rasa
Messages: 45
Registered: February 2006
Member
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
<ecapacity>

as it currently is.

Please help.

Previous Topic: Loading of xml into oracle relational table
Next Topic: Top link problem
Goto Forum:
  


Current Time: Thu Apr 25 17:40:15 CDT 2024