Microsoft Visio UML to XMI export

Microsoft Visio 2003 incluía el componente XMI Export para guardar modelos UML en formato XMI.

Esto no era posible en Microsoft Visio 2007 hasta ahora, con la salida del Microsoft Visio Service Pack 2 que incluye una nueva versión de este componente (instrucciones de uso al final)

Aunque considero muy positivo que Visio ofrezca algún tipo de soporte para XMI, mis primeras impresiones no son muy buenas: el fichero generado es exageradamente grande, parece que sólo se exportan los diagramas de clases (cosa que ya pasaba con el Visio 2003) y, lo más sorprendente, la exportación depende del lenguaje con el que se use Visio !! (es decir, el fichero XMI varía dependiendo de si se usa el Visio en español o en inglés).

Por ejemplo, para indicar que un association end no es una agregación, Visio generaría el siguiente XML Element para los usuarios de Visio en Español:

  • Foundation.Core.AssociationEnd.aggregation xmi.value=”ninguno”

pero en cambio generaría éste otro para los usuarios en Inglés:

  • Foundation.Core.AssociationEnd.aggregation xmi.value=”none”

donde “none” es la versión inglesa de “ninguno”. Esto es muy serio ya que implica que para importar un fichero XMI generado por Visio tendríamos que tener en cuenta estas variaciones lingüísticas. Increíble. Esperemos que esto se arregle en futuras versiones.

Como ejemplo, éste es el archivo XMI (¡más de 500k!) para este modelo UML:
Visio UML model

Además, activar el componente XMI Export no es tarea fácil. Gracias a la ayuda del Visio Insights msdn blog
, he conseguido descubrir como configurarlo. Después de instalar el SP2, hay que ir a “Herramientas->Macros->Abrir el editor de Visual Basic” y escribir y ejecutar el siguiente código:

Sub ExportXMI()

Application.Addons(“UML Background Add-on”).Run (“/CMD=400 /XMIFILE=”"C:\file.xmi”"”)

End Sub

Si estáis interesados en importar diagramas de clase UML hechos con Visio en otras herramientas como ArgoUML, Poseidon o Eclipse UML2, provad mi servicio de transformación de ficheros XMI

Si te ha gustado esta entrada, puedes subscribirte a este blog y/o seguirme en twitter twitter

Y si realmente te ha gustado ayúdame a hacerlo llegar a otros utilizando los bookmarks que tienes a continuación:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Microsoft Visio UML to XMI export

UPDATE: If you are interested in importing Visio UML class diagrams in other tools as ArgoUML, Poseidon or Eclipse UML2 or in visualizing them online check out my XMI transformation service

Microsoft Visio 2003 included a XMI Export component to export UML models to XMI-compliant files.

However this was not possible in Microsoft Visio 2007 until now with the recent release of the Microsoft Visio Service Pack 2 that contains a new version of the XMI Export component (instructions below)

Although I think it is very positive that Visio offers some kind of XMI export support, my first impression is not very optimistic: the generated XMI is too verbose, it seems that only class diagram elements are exported (as happened with Visio 2003) and more surprisingly, the XMI export is language-dependent!! (that is, the XMI file presents small differences depending on the user predefined language).

For instance, to indicate that an association end it is not an aggregation, Visio would generate the following XML Element for Spanish Visio users:

  • Foundation.Core.AssociationEnd.aggregation xmi.value=”ninguno”

but this would be the XML element generated for English users:

  • Foundation.Core.AssociationEnd.aggregation xmi.value=”none”

where “ninguno” is the Spanish word for “none”. This implies that to import the generated XMI in another CASE tool we must deal with these language variations. Incredible. Let’s hope this will be fixed IN future releases.

AS an example, this IS the Visio XMI file (MORE than 500k!) CORRESPONDING TO this simple UML model:
Visio UML model

Activating the XMI export component IS NOT an easy task either. Thanks TO the help I’ve found in the Visio Insights msdn blog
, I’ve managed TO find out that the process IS the following. After installing the SP2, go TO “Tools->Macros->Open the Visual Basic Editor” AND WRITE AND EXECUTE the following code:

Sub ExportXMI()

Application.Addons(“UML Background Add-on”).Run (“/CMD=400 /XMIFILE=”"C:\file.xmi”"”)

END Sub

If you enjoyed the post you can subscribe TO this Modeling blog AND/OR follow me ON twitter

AND if you really liked it help me pass it ON TO others by bookmarking AND sharing the post USING the links below:

5 Responses to Microsoft Visio UML to XMI export

  1. Anonymous says:

    Thanks for posting the file – saved me the hassle of generating one.
    It’s quite different FROM the XMI produced by the previous ADD-ON (which bizarrely claimed TO be UML 1.2 – a revision OF UML that never officially saw the light OF DAY).
    As you point out it IS unusually verbose – due partly TO the use OF XML elements rather than XML attributes FOR absolutely every VALUE including xmi.id.
    However the huge SIZE OF the file IS due TO the presence OF a Subsystem element called “Sistema 1 de UML” which contains a large NUMBER OF ‘standard’ Stereotype definitions AND datatype definitions FOR 4 different programming languages (IDL, C++, C#, VB – surprise surprise NO Java). Removing this subsystem (which would be identical FOR ANY model) takes the SIZE down TO 42Kb!
    Also, each Class IN your model has 5 tagged VALUES applied: (sematica, persistencia, ubicacion, documentacion, responsilitad) (Attributes have just the LAST 2) even though they have NO VALUES. AND that’s a general theme – lots of empty elements unnecessarily included. And default values likewise.
    One bug I noticed – multiplicity is serlaized as * rather than as 2 separate values lower=0 and upper = -1 (the convention for * at UML 1.x).

  2. Anonymous says:

    Ok, I have managed to export my model. Edit it in another UML tool. Now I want to import back into Visio.

    Les. lmunday@gmail.com

  3. jordi says:

    unfortunately this is not possible since Visio does not offer an import functionality

  4. Anonymous says:

    Hello,

    I try to get this in visio, i want to make in uml a class with 2 attributes as the pk, and then xmi export.
    any idea?

    Thanks for help.

  5. jordi says:

    so you´ll need to define that information as a UML profile (btw, profiles are not yet supported by the XMItoXMI transformation service)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress
More in tools, XMI
UML tools – Textual notations to define UML models
Close