ORACLE DOM

childnode DBMS_XMLDOM.DOMNode;

childnode := DBMS_XMLDOM.item(child_nodelist, 0);

--childnode contains

<root>
<row><cell>a</cell></row>
<row><cell>b</cell></row>
<row><cell>c</cell></row>
</root>

I want to achieve at least one of the following:

1) convert the childnode to XMLTYPE?

2) convert the childnode to CLOB?

 

Thanks
eugenecaAsked:
Who is Participating?
 
slightwv (䄆 Netminder) Commented:
1) You might need to convert the node to a document/element first but look at:  DBMS_XMLDOM.GETXMLTYPE

http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_xmldom.htm#i1124847

2) use DBMS_XMLDOM.WRITETOCLOB

http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_xmldom.htm#i1078527
0
 
paquicubaCommented:
As slightwv mentioned above, you have to have a document in order to return DBMS_XMLDOM.GETXMLTYPE(<your document here>)

Something like this:

xml_doc                      dbms_xmldom.domdocument;

      -- Create handle for new XML doc
      xml_doc := dbms_xmldom.newdomdocument;
     
      -- Set the prologue
      dbms_xmldom.setversion(xml_doc, p_xml_version);
     
      -- Make the root node
      root_node := dbms_xmldom.makenode(xml_doc);

     -- Then append the childnode to the rootnode
     dbms_xmldom.appendchild(root_node, child_elmt_node);

It's more complex than the steps above, but you get the idea...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.