PeopleCode to Create XML and XSD file.
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();
Comments:4;

October 28th, 2009 at 11:37 pm
I want to use an existing xml schema file.How to use that?
Richard Says:Can i use it using the file layout?
October 9th, 2009 at 6:37 am
Hi,
Tushar Says: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
July 6th, 2009 at 2:02 am
Excellent post. Thank you for sharing this information.
XML Says:July 1st, 2009 at 8:45 am
HI,
Please send the documention on XML Publisher to following email address
sridhara.raju2000@gmail.com
Thanks,
AAAA