Function to remove unwanted characters etc in the output of xml tags in XML PUBLISHER
create or replace FUNCTION XXCUST_ENCODE_TO_XML
( p_value IN VARCHAR2
) RETURN VARCHAR2 AS
/* +====================================================================+
-- Name: XXCUST_ENCODE_TO_XML
-- Created by: Unknown
-- Creation Date: Unknown
-- Script: XXCUST_ENCODE_TO_XML.sql
-- Description: This procedure strips out special characters out of a character string
--
-- Change History:
-- ___________________________________________________________________________
-- Date Name Ticket# PVCS Ver Comments
-- ___________________________________________________________________________
-- +====================================================================*/
res varchar2(32000);
BEGIN
res:=p_value;
IF (INSTR(res,'&' ) != 0) THEN
res:=REPLACE(NVL(res,NULL),'&','&');
END IF;
IF (INSTR(res,'''' ) != 0) THEN
res:= REPLACE(NVL(res,NULL),'''',''');
END IF;
IF (INSTR(res,'~' ) != 0) THEN
res:= REPLACE(NVL(res,NULL),'~','');
END IF;
IF (INSTR(res,'�' ) != 0) THEN
res:=REPLACE(NVL(res,NULL),'�','N');
END IF;
IF (INSTR(res,'<' ) != 0) THEN
res:=REPLACE(NVL(res,NULL),'<','<');
END IF;
IF (INSTR(res,'>' ) != 0) THEN
res:=REPLACE(NVL(res,NULL),'>','>');
END IF;
IF (INSTR(res,'�' ) != 0) THEN
res:=REPLACE(NVL(res,NULL),'�','°');
END IF;
IF (INSTR(res,'"' ) != 0) THEN
res:=REPLACE(NVL(res,NULL),'"','"');
END IF;
IF (INSTR(res,CHR(10)) != 0) THEN
res:=REPLACE(NVL(res,NULL),CHR(10),' ');
END IF;
IF (INSTR(res,CHR(13)) != 0) THEN
res:=REPLACE(NVL(res,NULL),CHR(13),' ');
END IF;
--IF (INSTR(res,'�' ) != 0) THEN
-- res:=REPLACE(NVL(res,NULL),'�','N');
--END IF;
return res;
EXCEPTION WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,' XXCUST_ENCODE_TO_XML ERROR: '||SQLCODE||', '||SQLERRM||', p_value: '||p_value);
return p_value;
END XXCUST_ENCODE_TO_XML;
Comments
Post a Comment