The below code is useful to create XML and XSD file.  Create Application engine program with below code and run the AE program in App designer to get a file in local. You can get the same in server without specifying any path and give it as relative path instead of file absolute.

PSXP_XMLGEN application package used to create xml file. You can multiple parent and child records. This file is used for data import or export programs.

Import PSXP_XMLGEN:*;

/*Create Rowsets*/

&RS_ADR = CreateRowset(Record.EMPLOYEES);
&RS_PER = CreateRowset(Record.PERSON, &RS_ADR);

/*Fill Parent*/
&RS_PER.fILL(“WHERE EMPLID = ‘11902’”);

/*Fill Child*/
For &i = 1 To &RS_PER.Activerowcount

&row = &RS_PER.Getrow(&i);
&rs = &row.Getrowset(Scroll.EMPLOYEES);
&rs.fill(“Where emplid = :1”, &row.PERSON.emplid.value);
End-For;

/* Create XSD */

&rds = create PSXP_XMLGEN:RowSetDS();
&myschema = &rds.Getxsdschema(&RS_PER);
&f1 = GetFile(“C:\temp\rpt01.xsd”, “w”, %FilePath_Absolute);
&f1.writeline(&myschema);
&f1.close();

/*Create Sample XML File */

&myXMLfile = &rds.GetXMLData(&RS_PER, “C:\temp\rpt01.xsd”);
&f2 = GetFile(“C:\temp\rpt01.xml”, “w”, %FilePath_Absolute);
&f2.writeline(&myXMLfile);
&f2.close();

Posted by Cynthia Rachel
Comments (4)
October 29th, 2008

Comments (4)

rahul - October 28th, 2009

I want to use an existing xml schema file.How to use that? Can i use it using the file layout?

Richard - October 9th, 2009

Hi, i'm searching for the code to launch a Template file attach to a XML with a push button and a query ?? Not with a AE. Thank you very much for help Richy

Tushar - July 6th, 2009

Excellent post. Thank you for sharing this information.

XML - July 1st, 2009

HI, Please send the documention on XML Publisher to following email address sridhara.raju2000@gmail.com Thanks, AAAA

Comments are closed.