Generation of Class Diagram from XMI

纵饮孤独 提交于 2019-12-03 06:21:05
XedinUnknown

One of the ways to do this would be to take the approach illustrated in my attempt 2 or 4, and then follow instructions given here for Enterprise Architect.

To generate an XMI file using PHP_UML:

  • Follow these instructions to install PEAR if not installed already, if you have PHP installed separately.
  • If you are using XAMPP under Windows (my case), follow these instructions to add PEAR to the PATH env variable and thus make PEAR available through CMD, and to learn how to install packages in both *nix and Windows systems. Hint: the PATH separator is ";" (semicolon) for Windows.
  • In some setups, like if using XAMPP, you may need to activate the XSL extension. In this case, open your php.ini file (you may need Administrator privileges to save it), and uncomment or add the following line to the bottom of the "Dynamic Extensions" section: extension=php_xsl.dll.
  • Install the PHP_UML package with pear install PHP_UML.
  • Execute phpuml -f xmi -o name_of_output_dir. If you're planning to use the generated XMI with some older programs later, you may need to specify XMI version 1 by adding -x 1.
  • For me, this did not work immediately, saying that I am missing ../../data/xmlschema.rng. Not sure why this happened, but if you get a similar error, you can download it from here and place it into the data folder right under your PEAR directory.

This XMI can later be used with Enterprise Architect, ArgoUML and other XMI tools.

(Edit : This answer is an alternative for people that want to generate UML class diagram from a PHP project, it doesn't explains how to read XMI files)

Goal

I need to see a graphical representation of the class relationships, possibly in varying depths and varying degrees of complexity. Also, it would be nice if the classes in the diagram are clickable. I do not necessarily need to generate documentation.

If your goal was to generate a class diagram from a PHP project, I found a better solution than use PHP_UML. What you probably want is BoUML, with this software, you can select a PHP project folder and reverse engineering it. Then create a class diagram. When you drag&drop the class on it, the relations are there unlike AlgoUML (If I'm not wrong). XMI files are no longer useful in this case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!