API Export - Script Package Util
En Task zum exportiere vom API nach XML
[script 1.0]
script package rbsc$xml_util
is
/*
-------------------------------------------------------------------------------------------------------------
Bank:
Business Area:
Description: Utility to create "proper" XML from within Avaloq
-------------------------------------------------------------------------------------------------------------
ID Date Name, Company Issue Affected BUs, Description
-------------------------------------------------------------------------------------------------------------
001
-------------------------------------------------------------------------------------------------------------
*/
---------------------------------------------------------------------------
-- returns a valid XML text by escaping special characters like &,> and <
---------------------------------------------------------------------------
function encode(
i_text long
) return long
is
l_text long;
begin
l_text := replace(i_text, '&', '&')
l_text := replace(l_text, '"', '"')
l_text := replace(l_text, '<', '<')
l_text := replace(l_text, '>', '>')
l_text := replace(l_text, '''', ''')
l_text := regexp_replace(l_text,'[^'||chr(32)||'-'||chr(255)||chr(09)||'-'||chr(10)||']+',' '); -- remove non-printable charachters
return l_text;
end encode;
---------------------------------------------------------------------------
-- returns a valid XML text by escaping special characters like &,> and <
---------------------------------------------------------------------------
function decode(
i_text long
) return long
is
l_text long;
begin
l_text := replace(i_text, '&', '&')
l_text := replace(l_text, '"', '"')
l_text := replace(l_text, '<', '<')
l_text := replace(l_text, '>', '>')
l_text := replace(l_text, ''', '''')
return l_text;
end decode;
---------------------------------------------------------------------------
-- returns a simple XML element which can be appended to a buffer or output file:
-- <i_tag>i_text</i_tag>
-- The procedure transforms the characters &<> appropriately
---------------------------------------------------------------------------
function get_xml_element(
i_tag text -- ELEMENT TAG WITHOUT < >
,i_text long -- ELEMENT TEXT
) return long
is
l_text long;
begin
return '<' || i_tag || '>' || encode(i_text) || '</' || i_tag || '>' || chr(10);
end get_xml_element;
end rbsc$xml_util;