How to read XMI?

kane77 picture kane77 · Feb 20, 2010 · Viewed 13.6k times · Source

I need to read UML diagrams that are serialized into XMI. Is there any library that would allow me to conveniently read UML XMI - by conveniently I mean having some methods to iterate over classes/packages/methods/attributest etc. in model.

I tried EMF, but I am unable to find any tutorial that would show how to import XMI containing UML. I have also found NSUML/NSMDF but the link to documentation is broken.

Answer

Jordi Cabot picture Jordi Cabot · Feb 25, 2010

I don't think what you want exists. All tools importing XMI that I know (including my XMI transformation service: http://modeling-languages.com/content/xmi2-tool-exchanging-uml-models-among-case-tools) work by parsing the whole XMI file and creating the corresponding UML model in main memory. Then you can access to the UML elements by querying the model.

To iterate on the XMI model you can easily use XML libraries to select the pieces of the XMI file you are interested in.