Below are the Steps to create a XSD for Rowset Type Data Source and sample code.
1. Create an Application Engine Program and Insert a PeopleCode Step into it.
Write PeopleCode to Perform below steps.
a. Import Application Package
b. Create Rowset
c. Populate Data to Rowset
d. Create XSD
e. Create Sample XML file with data
Sample Code. Replace File Path and File name accordingly.
import PSXP_XMLGEN:*;
Local Rowset &Rowset_XMLP;
/* Create Rowset */
&Rowset_XMLP = CreateRowset(Record.
/* Fill rowset */
&Rowset_XMLP.Fill();
/* Create XSD */
&ObjRowsetXSD = create psxp_xmlgen:RowSetDS();
&XSDSchema = & ObjRowsetXSD.GetXSDSchema(&Rowset_XMLP);
/* Write you schema into an output file so that you can upload it to the Data Source */
&XSDFile = GetFile("File_Path\File_Name.xsd", "W", %FilePath_Absolute);
& XSDFile.WriteLine(&XSDSchema);
& XSDFile.Close();
/* Create Sample XML File */
&ObjRowsetXSD = create psxp_xmlgen:RowSetDS();
&XMLFile = &ObjRowsetXSD.getXMLData(&Rowset_XMLP, "(File_Path\File_Name of XSD)”;
&SampleXMLFile = GetFile("File_Path\File_Name.xml", "W", %FilePath_Absolute);
& SampleXMLFile.WriteLine(&XMLFile);
& SampleXMLFile.Close();