Showing posts with label xml parsing. Show all posts
Showing posts with label xml parsing. Show all posts

Thursday, September 13, 2012

XML Response file not parsing

We faced big issue on UAT days due to hidden error caused by XMLPARSER

    response_parser := xmlparser.newparser;
    xmlparser.parseclob(response_parser, response_clob);
    resp_dom_doc := xmlparser.getdocument(response_parser);


This caused SOAP UI response XML parsing error and aborting
supportable search , presenting incomplete results.

Exception: ORA-31011: XML parsing failed ORA-19202: Error
occurred
in
XML processing LPX-00217: invalid character 26 (U+001A) Error at
line 1 Stack: ORA-06512: at "XDB.DBMS_XMLPARSER", line 191
ORA-06512: at "APPS.XXRH_SUPX_USER_SVC_PKG", line 759
 
After lot of search on net and Oracle SR, I found below simple solution to replace control characters from XML clob
 
pout_response_clob:= regexp_replace(pout_response_clob, '['||chr(1)||'-'||chr(13)||chr(14)||'-'||chr(31)||chr(127)||']','');
 
What this does is replaces all the control chars and gives back clob which can be parsed by XMLPARSER
 
More details - https://forums.oracle.com/forums/thread.jspa?messageID=10265001
 
There are other related functions like DBMS_XMLGEN.CONVERT , DBMS_LOB.CONVERTCLOB etc 
 
This finding helped us to save big go-live!!!
 
"Dhundane pe khuda bhi milta hain! "