Structure
XMISerializer
Serialises EMF objects to XMI (XML Metadata Interchange) format
struct XMISerializer
Overview
The XMI serialiser converts in-memory object graphs stored in Resources to XMI files. It handles:
-
Metamodel (.ecore) files with full Ecore support
-
Model instance (.xmi) files with arbitrary attributes
-
Containment references (nested elements)
-
Same-resource references (href attributes with XPath, e.g.,
href="#//@employees.0") -
Cross-resource references (href attributes with URI and fragment, e.g.,
href="department-b.xmi#/") -
Proper XML namespace declarations
Cross-Resource References
When a reference points to an object in another resource (represented as a ResourceProxy), the serializer generates an href with the target resource’s URI and fragment:
<mainDepartment href="department-b.xmi#/"/>
Usage Example
let serializer = XMISerializer()
try await serializer.serialize(resource, to: outputURL)
Topics
Initializers
Initialise a new XMI serialiser
Instance Methods
Serialise a Resource to an XMI string
Serialise a Resource to an XMI file
Relationships
Conforms To
See Also
Resources and Serialisation
A resource manages model objects and provides EMF-compliant reference resolution.
A resource set manages multiple resources and enables cross-resource reference resolution.
Parser for XMI (XML Metadata Interchange) files
Parser for JSON files in emfjson/pyecore format
Serializes EMF objects to JSON format (emfjson/pyecore compatible)