Thursday, April 24, 2008

Is XML Publisher complicated?

Is XML Publisher complicated?

May be not if you have given it a try. The previous versions of Template builder supplied to PeopleSoft developers do make it look complicated. Try the latest version of template builder 5.6.2+ and you might fall in love with this again.

Get the new template builder from Oracle OTN site as the offering by PeopleSoft application is old.

PeopleSoft and other blogs explain a lot about Query based data source but as we PeopleSoft developers use PeopleCode day in and day out how do we use rowset based data source?

Many question asked about how we create the code to generate data file using rowset based XML Publisher.

1) Create an Application Engine to create sample XSD and XML file
2) I assume you have already installed the plug in for the XML Publisher and worked with query data source.
3) Here we are talking about using PeopleCode to create XML Publisher reports.
4) Create an Application Engine with the below pasted code
5) Use appropriate table and you will have the files (Schema and Sample Data) ready.
6) Use these data sources to create your template. The Business analysts can change these templates as and when client wishes.
7) The templates are effective dated so you can change the template and add it to the report definition without a need of a developer. Run the report and get result in the format you/Client need.
8) Use the above created template in you XML Publisher process definition.
9) The Application Engine so far is only built to provide sample files to create the template.
10) Once the template is built, the developer will update the Application Engine to publish entire data.
11) Good luck!

Sample Code

import PSXP_XMLGEN:*;

/* Import the Application Package and define the rowset*/

Local Rowset &rs;

/* CREATE ROWSETS*/

&rs = CreateRowset(Record.PERS*****TBL);

rem &full = createrowset(record.parent, &rs);

&rs.Fill("where emplid like '***%'");



/* Create schema files and Sample data files */


&RowsetDataSource = create PSXP_XMLGEN:RowSetDS();
&rds = create PSXP_XMLGEN:RowSetDS();
&myschema = &rds.GetXSDSchema(&rs);
&f1 = GetFile("C:\temp\schema.xsd", "W", %FilePath_Absolute);
&f1.WriteLine(&myschema);
&f1.close();



&myxmlfile = &rds.GetXMLData(&rs, "C:\temp\schema.xsd");
&f2 = GetFile("C:\temp\xmlfile.xml", "w", %FilePath_Absolute);
&f2.WriteLine(&myxmlfile);
&f2.close();

No comments: