Author Topic: generating html doc from XMI files?  (Read 5310 times)

dano_labrosse

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
generating html doc from XMI files?
« 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

thomaskilian

  • Guest
Re: generating html doc from XMI files?
« Reply #1 on: July 12, 2005, 04:44:46 am »
You probably have to import the XMI into EA in order to generate HTML documentation. Except someone has got a XMI2HTMLDOC converter.

dano_labrosse

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: generating html doc from XMI files?
« Reply #2 on: July 12, 2005, 05:09:02 am »
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

thomaskilian

  • Guest
Re: generating html doc from XMI files?
« Reply #3 on: July 12, 2005, 05:32:20 am »
You probably have to specify an explicit repository that you deal with (AFAIK Openfile is missing)?

dano_labrosse

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: generating html doc from XMI files?
« Reply #4 on: July 12, 2005, 08:44:03 am »
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

thomaskilian

  • Guest
Re: generating html doc from XMI files?
« Reply #5 on: July 13, 2005, 02:46:06 am »
I'll see whether I can give it a try today. However, just to be sure, did you try to do the steps manually?

dano_labrosse

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: generating html doc from XMI files?
« Reply #6 on: July 13, 2005, 03:05:17 am »
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

thomaskilian

  • Guest
Re: generating html doc from XMI files?
« Reply #7 on: July 13, 2005, 03:19:29 am »
The documentation for ImportPackageXMI (String, String, Long, Long) is not very precise:
Quote
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.
« Last Edit: July 13, 2005, 03:20:41 am by thomaskilian »

dano_labrosse

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: generating html doc from XMI files?
« Reply #8 on: July 13, 2005, 03:59:51 am »
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!