XML Model Files
For each ElementClass, the metamodel-expanders will generate an XMLReader and XMLWriter to read and write the models.
<dataChart/>
Attributes
Attributes can be defines as children of the root tag. Attributes called name, however, should be defined as an XML attribute.
<dataChart name="SpaceshipDataChart">
<description>My first DataChart</description>
<refresh>true</refresh>
</dataChart>
Associations
Association References are defined as children of the root tag. Each ElementClass that is a target of a association Reference should define one or more identifier attributes. These will be used in the XML to refer to an instance of that ElementClass.
<dataChart name="SpaceshipDataChart">
<type name="PieChart"/>
</dataChart>
<dataChartType name="PieChart"/>
When referencing an element that is part of a composition hierarchy, the identifiers of the parent have to be included.
<dataChart name="SpaceshipDataChart">
<dataElement component="space" name="Spaceship"/>
</dataChart>
Composition
Composition References appear in XML models as nested elements.
<dataChart name="SpaceshipDataChart">
<filters>
<dataChartFilter name="filterByType">
<filter>type</filter>
</dataChartFilter>
<dataChartFilter name="filterByLocation">
<filter>location</filter>
</dataChartFilter>
</filters>
</dataChart>
If the Cardinality of the Composition Reference is 0-1
or 1-1
, the child element will be nested directly in the parent tag.
<dataChart name="SpaceshipDataChart">
<caption>
<text>Number of Spaceships in orbit</text>
</caption>
</dataChart>
For children of a module ElementClass, the ElementClasses should be placed in directories with the name of the elementClass + "s"
.
This directory can be modified by customizing the XMLReader class (find the custom-model-subdir
anchor).
Opposite references are not represented in the XML, since the information is already known by looking at the hierarchy.
Extensions
Extension References to a module or program, like Component or Application, work as if the owner of the Reference has is a composite child of the target. Place the XML files of the ElementClass in a directory under the module/program directory.
components
└── space
├── model
. ├── space.xml
└── dataCharts
└── SpaceshipDataChart.xml
For extension References to a regular element, the file should be place in a directory <parent.name>/<element.name>s/
next to the XML of the parent.
components
└── space
├── model
. ├── space.xml
└── dataElements
├── Spaceship.xml
└── Spaceship
└── dataCharts
└── SpaceshipDataChart.xml