Book a Demo

Author Topic: Error occurs exporting model to XMI  (Read 3958 times)

Dan Glasser

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Error occurs exporting model to XMI
« on: February 01, 2011, 04:01:59 am »
Hi,

I'm trying to use Project.ExportPackageXMI(..).  The export is empty and errors out during, what seems to be, one of the final steps.  The log file shows the processing of the various elements in the model as I would expect but it eventually fails stating:

"Export Failed! Check Filename and Details"

The filename in question is: "C:\export.xml".  I'm not sure what other "Details" to check.

The code is as follows:
Code: [Select]
string packageGuid = rootNode.PackageGUID;
EnumXMIType xmi = EnumXMIType.xmiEA21;
int diagramXml = 1;
int diagramImage = -1;
int formatXml = 0;
int useDtd = 0;
repository.GetProjectInterface().ExportPackageXMI(packageGuid, xmi, diagramXml, diagramImage, formatXml, useDtd, saveDialog.FileName);

I've tried other options for the various parameters, but all permutations have come up with the above error.  Any guidance would be appreciated.

using v. 8.0.864

- Dan
« Last Edit: February 01, 2011, 05:55:05 am by djglasser »

alesliehughes

  • EA Administrator
  • EA User
  • *****
  • Posts: 104
  • Karma: +0/-0
    • View Profile
Re: Error occurs exporting model to XMI
« Reply #1 on: February 01, 2011, 09:20:41 am »
Hi Dan,

This message is displayed when the xml file cannot be written. Do you have permission to write to c:\?

Alistair

Dan Glasser

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Error occurs exporting model to XMI
« Reply #2 on: February 02, 2011, 02:42:32 am »
Hi, Thanks for the input.

Yes, I have admin privileges.  In fact, I should have mentioned earlier,  the export works perfectly fine if I launch it from the EA application menu.  It just fail launching it from the Automation Interface.

- Dan

alesliehughes

  • EA Administrator
  • EA User
  • *****
  • Posts: 104
  • Karma: +0/-0
    • View Profile
Re: Error occurs exporting model to XMI
« Reply #3 on: February 03, 2011, 10:44:44 am »
Hi Dan,

I created a JavaScript within Enterprise Architect with the following
Code: [Select]
function main()
{
      var packageGuid = Repository.Models.GetAt(0).PackageGUID;
      var xmi = xmiEA21;
      var diagramXml = 1;
      var diagramImage = -1;
      var formatXml = 0;
      var useDtd = 0;
      GetProjectInterface().ExportPackageXMI(packageGuid, xmi, diagramXml, diagramImage, formatXml, useDtd, "C:\\outout.xml");
}

main();


Try the above, and if its fails, contact support for more help.

Is this code in an Addin, and if so what language is being used?

Alistair

Dan Glasser

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Error occurs exporting model to XMI
« Reply #4 on: February 04, 2011, 03:35:30 am »
Your script actually succeeded.  I had to modify it, setting
Code: [Select]
var xmi = 0Which corresponds to xmiEADefault because I wasn't able to get it to recognize the enum.  Your script reported the error: "xmiEA21 is not defined, Line:4".

To answer your question, yes this export code is being launched from an Add-In using C#.  The Add-In creates the model and then attempts to export it.