Question
Evgeny Shvarov · Nov 20, 2016

How to export class package in xml

Hi!

Is there any way to export a class package to xml  file programmatically which will include all the classes of the package?

1
0 1,319
Discussion (12)2
Log in or sign up to continue
SAMPLES>do $system.OBJ.ExportPackage("Sample","samples.xml")

Exporting class: Sample.Address
Exporting class: Sample.Company
Exporting class: Sample.CustomResultSet
Exporting class: Sample.Customer
Exporting class: Sample.Employee
Exporting class: Sample.Installer
Exporting class: Sample.ListOfPersonIdentification
Exporting class: Sample.MyException
Exporting class: Sample.Person
Exporting class: Sample.PersonIdentification
Exporting class: Sample.ResultSets
Exporting class: Sample.Task
Exporting class: Sample.TaskExample1
Exporting class: Sample.TaskExample2
Exporting class: Sample.TaskExample3
Exporting class: Sample.USZipCode
Exporting class: Sample.Utils
Exporting class: Sample.Vendor

Thanks, Dmitry! Tried with $System.OBJ.Export and was not successful.  Maybe makes sense to add "Export Package" functionality to general OBJ.Export too.

This is cool! Moreover, this:

w $System.OBJ.Export("Package1.*,Package2.*","Solution.xml")

will export two your class packages into the one 'solution.xml'.

One detail regarding this. To export only classes (and not Globals and OBJ code) you should put it in the pattern:

w $System.OBJ.Export("Sample.*.CLS")

will export only the classes.

But that's what the ExportPackage functions is for. 

What does $System.OBJ.ExportPackage() function do special which $System.OBJ.Export() doesn't?

Yes.

Finally calls:

d $System.OBJ.Export("Sample.*.cls","sample1.xml")

and

d $System.OBJ.ExportPackage("Sample","sample2.xml")

produce equal files of Sample package export in "xml" format.

Good day Evgeny,

Whilst on this topic, I have been unsuccessful in producing an XML export of the csp pages, similar to the XML produced by exporting in studio. If possible to do this, please assist with the syntax.

How about this?

SAMPLES>s sc=$system.OBJ.Export("/csp/samples/*.csp","c:\s\junk.xml","/recursive=1")
 
Exporting to XML started on 10/29/2018 09:36:31
Exporting CSP/CSR or file: /csp/samples/basic.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Cinema.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Film.csp
Exporting CSP/CSR or file: /csp/samples/cinema/LoadData.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Order.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Search.csp
Exporting CSP/CSR or file: /csp/samples/cinema/SearchResults.csp
Exporting CSP/CSR or file: /csp/samples/cinema/ShowTimes.csp
Exporting CSP/CSR or file: /csp/samples/cinema/TopPicks.csp
Exporting CSP/CSR or file: /csp/samples/context.csp
Exporting CSP/CSR or file: /csp/samples/cookie.csp
Exporting CSP/CSR or file: /csp/samples/custom.csp
Exporting CSP/CSR or file: /csp/samples/error.csp
Exporting CSP/CSR or file: /csp/samples/expires.csp
Exporting CSP/CSR or file: /csp/samples/form.csp
Exporting CSP/CSR or file: /csp/samples/formsubmit.csp
Exporting CSP/CSR or file: /csp/samples/include.csp
Exporting CSP/CSR or file: /csp/samples/includedpage.csp
Exporting CSP/CSR or file: /csp/samples/inspector.csp
Exporting CSP/CSR or file: /csp/samples/iterate.csp
Exporting CSP/CSR or file: /csp/samples/language.csp
Exporting CSP/CSR or file: /csp/samples/logerror.csp
Exporting CSP/CSR or file: /csp/samples/loop.csp
Exporting CSP/CSR or file: /csp/samples/lottery.csp
Exporting CSP/CSR or file: /csp/samples/lotteryend.csp
Exporting CSP/CSR or file: /csp/samples/lotteryhistory.csp
Exporting CSP/CSR or file: /csp/samples/lotteryjoin.csp
Exporting CSP/CSR or file: /csp/samples/lotterymain.csp
Exporting CSP/CSR or file: /csp/samples/lotterymenu.csp
Exporting CSP/CSR or file: /csp/samples/menu.csp
Exporting CSP/CSR or file: /csp/samples/object.csp
Exporting CSP/CSR or file: /csp/samples/popform.csp
Exporting CSP/CSR or file: /csp/samples/private.csp
Exporting CSP/CSR or file: /csp/samples/protected.csp
Exporting CSP/CSR or file: /csp/samples/protectedentry.csp
Exporting CSP/CSR or file: /csp/samples/query.csp
Exporting CSP/CSR or file: /csp/samples/redirect.csp
Exporting CSP/CSR or file: /csp/samples/rulemgr.csp
Exporting CSP/CSR or file: /csp/samples/serversideredirect.csp
Exporting CSP/CSR or file: /csp/samples/sessionevents.csp
Exporting CSP/CSR or file: /csp/samples/showsource.csp
Exporting CSP/CSR or file: /csp/samples/soapdemo.csp
Exporting CSP/CSR or file: /csp/samples/staticsql.csp
Exporting CSP/CSR or file: /csp/samples/streamserve.csp
Exporting CSP/CSR or file: /csp/samples/submit.csp
Exporting CSP/CSR or file: /csp/samples/svgdemo.csp
Exporting CSP/CSR or file: /csp/samples/testerror.csp
Exporting CSP/CSR or file: /csp/samples/textinclude.csp
Exporting CSP/CSR or file: /csp/samples/upload.csp
Exporting CSP/CSR or file: /csp/samples/wapzipcode.csp
Exporting CSP/CSR or file: /csp/samples/while.csp
Exporting CSP/CSR or file: /csp/samples/xmlclasses.csp
Exporting CSP/CSR or file: /csp/samples/xmlclasseserror.csp
Exporting CSP/CSR or file: /csp/samples/xmlclassesresult.csp
Exporting CSP/CSR or file: /csp/samples/xmlimport.csp
Exporting CSP/CSR or file: /csp/samples/xmlquery.csp
Exporting CSP/CSR or file: /csp/samples/xmlqueryresult.csp
Exporting CSP/CSR or file: /csp/samples/zipcode.csp
Export finished successfully.
 
SAMPLES>

Thank you very much John. The right syntax makes all the difference, it works as expected.