Härzlig willkome zue minere Bocksnip Code-Gallerie um alli Arte vo Code z'teile.

API Export - Script Package Util

Avaloq · August 31, 2016 11:24 am

0 0 385

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, '&', '&amp;')
l_text := replace(l_text, '"', '&quot;')
l_text := replace(l_text, '<', '&lt;')
l_text := replace(l_text, '>', '&gt;')
l_text := replace(l_text, '''', '&apos;')
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, '&amp;', '&')
l_text := replace(l_text, '&quot;', '"')
l_text := replace(l_text, '&lt;', '<')
l_text := replace(l_text, '&gt;', '>')
l_text := replace(l_text, '&apos;', '''')
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;

Besprich das Bocksnip
    Kei Kommentar zur Diskussion gfunde

    Du muesch igloggt si, um über das Bocksnip z'diskutiere
boecki

boecki

Nimmt teil
August 13, 2016

  • 64 Bocksnipa
    gschriebe
  • 0 Likes
    verteilt
  • 1 Kommentär gmacht
Bocksnip Tags
Teil din Code

Organisier und teil all dini Code Snips a eim Platz.