Add Import/Export Scripts

In Enterprise Architect, it is possible to import packages from and export (or Publish) packages to external files in a range of XMI and XML formats. You can also incorporate this facility in your MDG Technology, adding a script that contains your own Extensible Stylesheet Language Transformation (XSLT) to convert between the file formats.

Incorporate an Export (Publish) script

Step

Description

See also

1

In your preferred editor, create an XSLT to convert from the source format (as listed on the Publish Model Package dialog) into the target format you are generating.

 

 

2

In Enterprise Architect, open the Scripter window and create a script under your preferred script engine as a Normal script.

Cut and paste the XSLT into the script editor.

 

Scripting

3

Add the script to your MDG Technology, in the MDG Technology Creation Wizard.

 

Add Scripts

4

Make any additions to the technology .MTS file you require, then use the MDG Technology Creation Wizard again to fully generate the technology .XML file.

Open the technology .XML file (not the .MTS file) in a text editor and locate the <Script section.

Working with MTS Files

Create MDG Technologies

 

5

Edit the <Script line to set the appropriate name, type and language:

name is the technology option text to display in the Extensions | Publish menu in the Enterprise Architect menu bar
type is the word Publish- followed by the name of the file format to export, as listed on the Publish Model Package dialog
language is XSLT

 

For example:

 

<Script

    name="YourTechnology"

    type="Publish-UML 2.1(XMI 2.1)"

    language="XSLT">

<Content

   xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">

</Content>

</Script>

 

 

 

6

Save the MDG technology .XML file, and deploy it on your system.

Deploy An MDG Technology

 

Incorporate an Import script

Step

Description

See also

1

In your preferred editor, create an XSLT to convert from the source format into the target XMI format.

 

 

2

In Enterprise Architect, open the Scripter window and create a script under your preferred script engine as a Normal script.

Cut and paste the XSLT into the script editor.

 

Scripting

3

Add the script to your MDG Technology, in the MDG Technology Creation Wizard.

 

Add Scripts

4

Make any additions to the technology .MTS file you require, then use the MDG Technology Creation Wizard again to fully generate the technology .XML file.

Open the technology .XML file (not the .MTS file) in a text editor and locate the <Script section.

 

Working with MTS Files

Create MDG Technologies

 

5

Edit the <Script line to set the appropriate name, type and language:

name is the technology option text to display in the Extensions | Import menu in the Enterprise Architect menu bar
type is the word Import- followed by the name of the XMI file format to generate, as listed on the Publish Model Package dialog
language is XSLT

 

For example:

 

<Script

    name="YourTechnology"

    type="Import-UML 2.1(XMI 2.1)"

    language="XSLT">

<Content

   xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">

</Content>

</Script>

 

 

 

6

Save the MDG technology .XML file, and deploy it on your system.

Deploy An MDG Technology

 

Notes

Create the content of your scripts in XSLT 1.0

Learn more