Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tbeckum

Pages: [1]
1
Automation Interface, Add-Ins and Tools / Re: automated xml export
« on: September 06, 2006, 03:59:45 pm »
The answer is, the output file string uses forward slashes instead of double back slashes.
change C:/TEMP/autoexported.xml to C:\\TEMP\autoexported.xml and I'm in business.

Would be much nicer had EA not failed silently in this case though.

2
Automation Interface, Add-Ins and Tools / Re: automated xml export
« on: September 06, 2006, 01:56:14 pm »
So I have been trying this, and my code executes with no errors, but no file is created. Also, the string result returned from ExportPackageXMI is an empty string. Not sure if that is a good indication or bad one.

So here is my method. Anyone see what I am doing wrong?
Code: [Select]

       public bool Export(string eapFilePath, string xmiFilePath, bool includeDiagrams)
       {
           try
           {
               EA.Repository r = new EA.RepositoryClass();
               r.OpenFile(eapFilePath);

               EA.Package topPackage = r.Models.GetAt(0) as EA.Package;
               EA.Package p = topPackage.Packages.GetAt(0) as EA.Package;
               string packageGUID = p.PackageGUID;
               System.Console.WriteLine("Trying to export package name [" + p.Name + "].");

               /*
               int diagramXML = 0;
               int diagramImage = -1;
               int formatXML = 1;
               int useDTD = 0;
               EA.EnumXMIType xmiType = EA.EnumXMIType.xmiMOF14;
               */
               EA.EnumXMIType xmiType = EA.EnumXMIType.xmiEA11;
               int diagramXML = 1;
               int diagramImage = 0;
               int formatXML = 1;
               int useDTD = 1;
               xmiFilePath = "C:/Temp/autoexported.xml";
               string result =
                   r.GetProjectInterface().ExportPackageXMI(packageGUID, xmiType,
                       diagramXML, diagramImage, formatXML, useDTD, xmiFilePath);
               r.CloseFile();

           }
           catch (Exception e)
           {
               System.Console.WriteLine(e.Message);
           }

           return true;
       }

Any tips would be appreciated.

Pages: [1]