Hi,
i want to do an xml export and import of all the models in a database using a script or macro.
Can any one please suggest how this can be done.
Thanks in advance.
Hi,
i want to do an xml export and import of all the models in a database using a script or macro.
Can any one please suggest how this can be done.
Thanks in advance.
Hi Sunil,
to export the entire database as an XML export, you should use the XMLExport report API:
var xmlExport = Context.getComponent("XMLExport")
First, you create an "options"-object with "root group" as the element to be exported and all languages you want to export.
You can optionally set further export options.
var rootGroup = ArisData.getSelectedDatabases()[0].RootGroup()
var options = xmlExport.createDefaultXMLExportOptions(rootGroup, [Context.getSelectedLanguage()] )
With this, you can start the export:
//see XMLExportResultWrapper2
var result = xmlExport.startExport2(options)
You'll find further information, also for XML import, in the ARIS Architect script help.
To import an xml export, you use the XML import API:
var import = Context.getComponent("XMLImport")
var options = import.createDefaultAMLOptions(...) or import.createDefaultAMLOptions2(...)
var mergeOptions = import.createDefaultMergeOptions()
...
//see XMLImportResultWrapper
var importResult = import.startImport(options, mergeOptions)
BR, Torsten
Hello Torsten,
I've found this post that i consider usefull.
However, using your code i don't receive the XML file at my client machine.
result.isSuccessful() returns true and result.getDuration() gives values that make me believe the export was done.
Using:
Context.addOutputFileName( result.getFileResult().getName() , Context.getSelectedLanguage() );
i got an empty file.
Is there a way to send the XML file to the client machine, or at least some way to access its content and use something like:
Context.addOutputFile( ficheiro, (new java.lang.String("text file content")).getBytes("UTF-8") );
Best regards,
Nuno Santos