7. ASOLib—OpenROAD Server Library : XML Parameters for Use with GSCPs : How You Can Preprocess and Postprocess the XML : Example: Postprocessing
 
Share this page                  
Example: Postprocessing
To use postprocessing, you must create a 4GL procedure in your server application named iixmlpostprocess, which has no return value. Your procedure must accept a parameter named b_so_postprocessxml of type StringObject. At runtime, any call that has requested output XML data calls your procedure, passing the generated XML into the b_so_postprocessxml parameter. Your procedure can perform the XML processing or, in turn, call other procedures based on the calling procedure.
An example iixmlpostprocess procedure follows:
PROCEDURE iixmlpostprocess
(
    b_so_postprocessxml = StringObject DEFAULT NULL
)=
 DECLARE
    v_parentprocedure_name = VARCHAR(32) NOT NULL,
    i = INTEGER NOT NULL,
 ENDDECLARE
BEGIN

    v_parentprocedure_name = ProcExec(CurProcedure.Parent).ObjectSource.Name;
 
    v_parentprocedure_name = LowerCase(v_parentprocedure_name);
 
    CASE v_parentprocedure_name OF

    'scp_getauthorandbooks' :
        CALLPROC postxml_getauthorandbooks(
                               b_so_postprocessxml = BYREF(b_so_postprocessxml));
 
    DEFAULT:
    BEGIN
        /* Default processing is to remove the DTD. */

        i = b_so_postprocessxml.LocateString(
                            match         = ']>',
                            startposition = 1 );
 
        IF i < b_so_postprocessxml.Length
        THEN
            b_so_postprocessxml.LeftTruncate( endposition = i + 1);
        ENDIF;
    END;
 
    ENDCASE;
 END;