Generating XSD and XML for XML Publisher

During design phase of an XML Publisher Report it is usefule to be able to rapidly update your XSD files for the data source template. I found some delivered code that does it very nicely. The run control includes a flag to swith this on/off.

See SSF_PRNT_INV.CALLXMLP.Step02

&MainChunk is/are the final rowset/s generated prior to publishg to XML Publisher.

You'll need to include:
import PSXP_XMLGEN:*;




REM - Use this code to output both XSD and XML files;
REM - for use in the design phase;
If SSF_INVP_AET.SSF_OUTPUT_XML = "X" Or
SSF_INVP_AET.SSF_OUTPUT_XML = "B" Then
&oDS = create PSXP_XMLGEN:RowSetDS();
&MYFILE = GetFile(RTrim(SSF_INVP_AET.JF_FILE_DIR) | SSF_INVP_AET.PROCESS_INSTANCE | "_*" | ".xsd", "N", "UTF8", %FilePath_Absolute);
If &MYFILE.IsOpen Then
&sResult = &oDS.getXSDSchema(&MainChunk);
&MYFILE.WriteLine(&sResult);
&MYFILE.Close();
End-If;
&MYFILE = GetFile(RTrim(SSF_INVP_AET.JF_FILE_DIR) | SSF_INVP_AET.PROCESS_INSTANCE | "_*" | ".xml", "N", "UTF8", %FilePath_Absolute);
If &MYFILE.IsOpen Then
&sResult = &oDS.getXMLData(&MainChunk, "");
&MYFILE.WriteLine(&sResult);
&MYFILE.Close();
End-If;
End-If;
REM - End of design phase code ;

Project Flowchart (developer centric version)

Work in progress...



NVAL NVL Null no value in Oracle SQL

Argh, I seem to always forget this. Very annoying.

select nvl(
    (select emplid from psoprdefn where oprid = 'xxx')
, 'a') from dual