Prev Next

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 'Publish > Technologies' ribbon panel
  • 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 'Publish > Technologies > Publish' ribbon option in Enterprise Architect
  • 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