Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: dano_labrosse on July 12, 2005, 01:57:53 am
-
Hi,
I want to be able to check out our XMI files from CVS and automatically generate HTML documentation based on each XMI file. Currently, I can generate HTML doc from EAP files. i.e. by calling LoadProject and RunHTMLReport but I have been unable to do this by loading the XMI files only. Anyone know if this is supported?
Thanks
-Dano
-
You probably have to import the XMI into EA in order to generate HTML documentation. Except someone has got a XMI2HTMLDOC converter.
-
It would be good if I could just create a new EA project and add the XMI files into it on the fly. But i failed to the code below to work. Do you have any idea what I might be doing wrong?
EA.Project proj = new EA.ProjectClass();
proj.ImportPackageXMI("Test","C:\\dev\\workspace\\UML\\Test.xml", 1,1); //load the XMI
proj.RunHTMLReport ("Test", "c:\\", "png", "<default>", ".htm"); //run the html report
Thanks
-
You probably have to specify an explicit repository that you deal with (AFAIK Openfile is missing)?
-
EA.Project proj = new EA.ProjectClass();
proj.LoadProject("C:\\EAProjects\\UMLDoc\\UMLDoc.EAP");
proj.ImportPackageXMI("Views", "C:\\dev\\workspace\\UML\\Test.xml", 1,0);
proj.RunHTMLReport ("Test", "c:\\", "png", "<default>", ".htm");
The code above loads the project and generates the doc. however it still does not import the XMI file correctly. Not sure where to go from here?
Thanks
-
I'll see whether I can give it a try today. However, just to be sure, did you try to do the steps manually?
-
Yeah, I can import manually (using the GUI) and generate the html doc without and trouble. Its just the ImportPackageXMI method that does not seem to be working for me. Im using C#.
Thanks
-
The documentation for ImportPackageXMI (String, String, Long, Long) is not very precise:
param: PackageGUID [ String - in ] PackageGUID is the filename to import into (or overwrite).
param: Filename or XMLText [ String - in ] The name of the XMI file.
Note: If the String is of type filename it will interpreted as a source file, otherwise the String will be imported as XML text.
param: ImportDiagrams [ Long - in ]
param: StripGUID [ Long - in ] Boolean value to indicate whether you want to replace the element UniqueIDs on import. If stripped, then a package could be imported twice into EA - as two different versions.
Provides the ability to import an XMI file at a point in the tree.
So the first thing: you have to specify the GUID of the package, not the name (although they are talking of a filename, which doesn't make any sense). You find these in the properties window under Advanced Settings. Second: how does EA determine whether the second parm is a filename? I assume if it looks like a windows path. However. I also had no success. ImportPackageXMI does not raise any error, nor return a result, nor does it import the XMI. I use Perl (for not having anything better ;D). Maybe you try with the GUID but if you have no success, I'd simply send a bug report.
-
Problem solved!
EA.Project proj = new EA.ProjectClass();
proj.LoadProject("C:\\EAProjects\\UMLDoc\\UMLDoc.EAP");
proj.ImportPackageXMI("5C22316B-4766-4741-B9EE-21941353F08F", "C:\\dev\\workspace\\UML\\Test.xml", 1,1);
proj.RunHTMLReport ("Test", "c:\\", "png", "<default>", ".htm");
The first param in ImportPackageXMI specficies the GUID of the element that you wish to add the XML file to. In my case I created an View called "Build" which was a child of the root level "Views" node. I then got the GUID of the "Build" node and added it to the above code. The last parameter specifies whether to add the node if it already exists which means you can have duplicate nodes (would be nice if it would overwrite an existing node though)
Thanks for your help!