Friday, March 5, 2010

Convert ArgoUML to XMI

If you want to use ArchGenXML on UML models generated with ArgoUML >= 0.28, you'll have to export them to .xmi first. This is a quick way to do that automatically before running agx.

A shell script:
# Creates a .xmi file from an ArgoUML-generated .uml file.
# Usage: ./ filename.uml
# A file called filename.xmi will be created.

if [ ! -n "$1" ]
echo "Usage: `basename $0` input_file"

XMI_FILE=`echo $1 | sed 's/\.uml/\.xmi/'`
echo '<?xml version = "1.0" encoding = "UTF-8" ?>' > $XMI_FILE
sed -n '/<XMI*/,/<\/XMI>/p' $1 >> $XMI_FILE

Let the Makefile in your uml/ directory read:
./ MyProject.uml
archgenxml MyProject.xmi ../

and you'll only have to do is run make -C uml/

No comments: