Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to parse this XML with a very big CDATA

Jose ArósteguiNov 3 2020

Hi experts,
I'm using Oracle Database 12c Enterprise Edition Release 12.2.0.1.0  and we are calling a SOAP service that is returning this hell of XML. It's all enclosed into a big CDATA:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
      <BotPlus2Response xmlns="http://xxxxxxxxx.com/">
     <BotPlus2Result><![CDATA[<Registro><GTECONCOD>0</GTECONCOD><GTECONDES>PRODUCTOS SANITARIOS, DIAGNOSTICO IN VITRO, Y OTROS ARTICULOS</GTECONDES><GTECONPAD></GTECONPAD></Registro>
		             .....
		             <Registro><GTECONCOD>Z</GTECONCOD><GTECONDES>PRODUCTOS TRADICIONALES DE PLANTAS MEDICINALES</GTECONDES><GTECONPAD></GTECONPAD></Registro>
								 ]]></BotPlus2Result>
   </BotPlus2Response>
  </soap:Body>
</soap:Envelope>

I'm reading this "XML" into a CLOB variable, removing CDATA, and converting it to XMLTYPE:

l_response_clob               CLOB;
l_xml_response          XMLTYPE;
....
l_response_clob := replace (l_response_clob,'<![CDATA[','');
l_response_clob := replace (l_response_clob,']]>','');
l_xml_response := xmltype.createxml(l_response_clob);

But when I check the value in the table I see all these conversions to &lg; and >
image.pngWhat am I doing wrong?
Thanks,
Jose.

This post has been answered by cormaco on Nov 4 2020
Jump to Answer
Comments
Post Details
Added on Nov 3 2020
11 comments
1,727 views