Native XML File
Native XML is an Enterprise Architect-specific format for model exchange between various Enterprise Architect repositories. Native XML is, therefore, a mechanism for round-tripping models (that is, performing Enterprise Architect-to-Enterprise Architect transfers). Compared to XMI 1.1/2.1, this format has a structure that closely mimics the Enterprise Architect repository, so exporting to Native XML format is considerably faster compared to exporting to XMI 1.1/2.1.
By default, when importing an XMI 1.1/2.1 file over an existing Package, all information in the current Package is deleted from the model before the data is imported from the XMI file. With a Native XML file import, the existing Package will not be deleted from the model, but will instead be updated with data from the XML file. Therefore, importing a Native XML file will also be considerably faster than importing from XMI 1.1/2.1.
When exporting a Package to Native XML, the Package being exported will become the root Package in the XML file. The children of the Package being exported (that is, its elements, diagrams, connectors and so on) will be exported under the root Package in the XML file. When importing this file into a model, the Native XML Importer will check if:
- The root Package in XML exists in the model
- Any of the children of the root Package in XML exist in the model
If the target model does not contain the root Package in XML or its children, then the contents of the XML file will be created as new items in the model.
If the target model contains the root Package in XML and its children, then the existing items in the model will be updated with the contents of the XML file.
Importing a Native XML file to a model that contains some of the imported items
Your model might contain at least one Package that is also used in other models, but not necessarily in the same context. For example, consider the two projects shown here:
Package 'Order' exists in two separate projects, 'Project X' and 'Project Y'. In 'Project X' the 'Order' Package is available as a child of Package 'Abstract Class Model', whereas in 'Project Y' it is a View Package.
When you export the Package 'Abstract Class Model' from 'Project X' to Native XML, the XML file will contain:
- 'Abstract Class Model' as its root Package and
- All information on 'Abstract Class Model' and its children (including Package 'Order')
When this XML file is imported into 'Project Y', the Native XML Importer will determine that:
- The root Package in XML, 'Abstract Class Model', does not exist in the model
- The child Package 'Order' does exist in the model
In such a scenario, where the root Package in XML does not exist in the model but its children do, the 'Existing Import Item(s)' dialog will be displayed, which will list the items in XML that already exist in the model:
Double-click on an item in the list
Selects the item in the Browser window.
Replace Item(s) in Model with XML contents
Select this radio button to:
In our example, after import 'ProjectY' will have this content:
Retain Item(s) in Model and import entire XML with Strip GUIDs
Select this option to:
In our example, after import, 'ProjectY' will have this content:
As you can see, two copies of Package 'Order' will exist in 'ProjectY' after import. The View Package 'Order' that existed in the model before import will remain unchanged. The Package 'Order' from the XML file will be imported as a new Package under the imported 'Abstract Class Model' Package.
Cancel the XML Import.
Importing Native XML files into Models that contain the root XML Package and children, in a different location
Consider the combination of Projects and Packages shown here:
Packages 'Abstract Class Model' and 'Order' exist in two separate projects, 'Project X' and 'Project Y'. In 'Project X', 'Order' exists as a child of Package 'Abstract Class Model', whereas in 'Project Y' they are both peer Packages.
When Package 'Abstract Class Model' is exported from 'Project X' to Native XML, the XML file will contain:
- 'Abstract Class Model' as its root Package
- All information about 'Abstract Class Model' and its children (including Package 'Order')
When this XML file is imported into 'Project Y', the Native XML Importer determines that:
- The root Package in XML. 'Abstract Class Model', exists in the model
- The child Package 'Order' exists in the model
- The root Package and its children are in different locations in the model
In such a scenario, where the root Package in XML and its children exist in the model (albeit in different locations), the Importer will replicate the XML Package structure; that is, it will automatically move Package 'Order' under Package 'Abstract Class Model' in the model. The 'Existing Import Item(s)' dialog will not be displayed. After import, 'ProjectY' will have the contents shown:
- In the Corporate, Unified and Ultimate editions of Enterprise Architect, if security is enabled you need to have:
- 'Export XMI' permission to export Packages to Native XML
- 'Import XMI' permission to import Packages from Native XML
- Native XML files exported by Enterprise Architect version 15.0 or later cannot be imported by versions of Enterprise Architect earlier than 15.0
- Native XML files exported using the 'Export Package to XML' dialog will not be formatted (that is, 'pretty-printed'), even if the 'Format XMI Output' option is enabled in the 'XML Specifications' option-group of the 'Preferences' dialog
- If you are connected to a SQL Server repository, you require ALTER permission on the t_image table in Enterprise Architect, to be able to import model images