Ora10g - ORA-31185: DOM Nodes do not belong ... [message #202950] |
Mon, 13 November 2006 07:14 |
anny
Messages: 4 Registered: December 2002
|
Junior Member |
|
|
We have 10.2.0.2.0
I want to add child node using DBMS_XMLDOM.appendChild
/
DECLARE
d dbms_xmldom.DOMDocument;
c dbms_xmldom.DOMDocument;
dn dbms_xmldom.DOMNode;
cn dbms_xmldom.DOMNode;
doc CLOB;
child CLOB;
BEGIN
/*
valiable doc =
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<TicketMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<MessageID></MessageID>
</Header>
<Body>
</Body>
</TicketMessage>
*/
SELECT struct INTO doc FROM CC_XML_STRUCT
WHERE snam = 1;
d := dbms_xmldom.newDOMDocument(doc);
dn := dbms_xmldom.makeNode(d);
dn := dbms_xmldom.getFirstChild(dn);
/*
valiable child =
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Body>
<A>sssss</A>
</Body>
*/
SELECT struct INTO child
FROM CC_XML_STRUCT WHERE snam = 2;
c := dbms_xmldom.newDOMDocument(child);
cn := dbms_xmldom.makeNode(c);
cn := dbms_xmldom.getFirstChild(cn);
dn := dbms_xmldom.appendChild(dn, cn);
END;
At Oracle 9i - works OK
At Oracle 10g (10.2.0.2.0) I have an error
ORA-31185: DOM Nodes do not belong to the same DOM Document
at line:
dn := dbms_xmldom.appendChild(dn, cn);
Can anybody help ////
|
|
|
Re: Ora10g - ORA-31185: DOM Nodes do not belong ... [message #203521 is a reply to message #202950] |
Wed, 15 November 2006 06:47 |
anny
Messages: 4 Registered: December 2002
|
Junior Member |
|
|
In oracle/metalink I find: Bug No. 4655347:
ORA-31185: DOM NODES DO NOT BELONG TO THE SAME DOM DOCUMENT
The error is valid. - x_target_node := dbms_xmldom.appendChild(x_target_node, ndoc); fails with ORA-31185 becuase x_target_node originates from x_doc_in whereas ndoc originates from x_doc. . DOMDocuments x_doc_in and x_dox were created from separate calls to dbms_xmldom.newDOMDocument
Solution:
Basically the change requirement is that - to avoid the ORA-31185:, using dbms_xmldom.importNode(x_doc_in, ndoc, TRUE);
But when I modified my code:
from
c := dbms_xmldom.newDOMDocument(child);
cn := dbms_xmldom.makeNode(c);
cn := dbms_xmldom.getFirstChild(cn);
dn := dbms_xmldom.appendChild(dn, cn);
To:
c := dbms_xmldom.newDOMDocument(child);
cn := dbms_xmldom.makeNode(c);
cn := dbms_xmldom.getFirstChild(cn);
import_node := dbms_xmldom.importNode(c,cn,TRUE);
dn := dbms_xmldom.appendChild(dn, import_node);
Nothing change - I have the same
ORA-31185: DOM Nodes do not belong to the same DOM Document
Where I can find the solution...
|
|
|