I am trying to put together an XML document from several pieces. To get the data, I had several queries whose results were XMLTypes.
I found a function named getNodeFromFragment
in the xmldom package that looked like it could take these XMLTypes and return a DOMNode that contained them, but it doesn't seem to work.
Simple example here:
set serveroutput on;
declare
node xmldom.DOMNode;
node2 xmldom.DOMNode;
doc_node xmldom.DOMNode;
doc xmldom.DOMDocument;
el xmldom.DOMElement;
buf varchar2(1000);
begin
doc := xmldom.newDOMDocument;
el := xmldom.createElement(doc => doc, tagName => 'test');
node := xmldom.makeNode(elem => el);
xmldom.writeToBuffer(node, buf);
dbms_output.put_line('buffer: '||buf);
node := dbms_xmldom.getNodeFromFragment(XMLType('<outer><inner>soemthing</inner><inner>somethingelse</inner></outer>'));
xmldom.writeToBuffer(node, buf);
dbms_output.put_line('buffer: '||buf);
end;
/
Printing the <test/>
element works fine, but when I try to print the fragment as a node, nothing is output.
Any tips on getNodeFromFragment?