Example: Preprocessing
To preprocess XML data, you must create a 4GL procedure in your server application named iixmlpreprocess that has no return value. Your procedure must accept a parameter named b_so_preprocessxml of type StringObject. At runtime, any GSCP that receives input XML calls your procedure, passing the input XML into the b_so_preprocessxml parameter. Your procedure can perform the XML processing or, in turn, call other procedures based on the calling procedure (see example).
An example iixmlpreprocess procedure follows:
PROCEDURE iixmlpreprocess
(
b_so_preprocessxml = StringObject DEFAULT NULL
)=
DECLARE
v_parentprocedure_name = VARCHAR(32) 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 prexml_getauthorandbooks(
b_so_preprocessxml = BYREF(b_so_preprocessxml));
DEFAULT:
BEGIN
/* Default processing is to do nothing */
END;
ENDCASE;
END;
In the preceding code, prexml_getauthorandbooks is another user-written procedure that has specific XML processing to perform when input XML is passed to the scp_GetAuthorAndBooks GSCP.