7.2 XML model import/export format
The XML import/export
format closely
follows the structures of the GOPPRR metamodeling language used by MetaEdit+, so
anyone familiar with GOPPRR should have no problems understanding it. The
structure is basically as below.
1 <gxl>
2 <graph type="WatchApplication">
3 <slot name="Name">
4 <value>
5 <string>Stopwatch</string>
6 </value>
7 </slot>
8 <object>...
9 </object>
10 <binding>
11 <relationship>...</relationship>
12 <connection>
13 <role>...</role>
14 <port>...</port>
15 <object>...</object>
16 </connection>
17 </binding>
18 </graph>
19 </gxl>
The XML import/export document always starts with a
<gxl> tag (line 1). Each graph is
introduced with a <graph> tag
(line 2): there may be several graphs in one import/export file.
The structures at the start of the
<graph> tag are also found in all
other GOPPRR element tags: objects, relationships, roles and ports. Lines 3
– 7 in our example XML illustrate how the properties attached to the
GOPPRR elements are defined. Each property is introduced with a
<slot> tag whose name attribute
specifies its local name. Into the slot go an optional
<property> tag referring to the
property (not necessary for import), and a
<value> tag. The
<value> tag specifies the actual
value of this property, within a tag that specifies its data type (e.g.
<string> in line 5).
The graph definition then contains the objects and
bindings in that particular graph. Object definitions come first and are denoted
by an <object> tag (line 8).
Objects specify their type and properties as defined about for Graph. Binding
definitions follow the object definitions, each in its own
<binding> tag (line 10). A
binding definition contains definitions for its relationship
(<relationship> tag, line 11) and
connections (<connection> tag,
line 12). There must be at least two connections in each binding. The connection
definition contains the definitions for its role, port and object, denoted with
their respective tags <role>,
<port> and
<object> (lines 13 – 15).
If there is no port defined for the connection, the
<port> tag is omitted.
This is the format expected for import; the exported files
contain more details such as unique database object oid’s, which are
ignored on import. The tags
<graph>,
<object>,
<relationship>,
<role> and
<port> all have the same
structure for their attributes and property slot elements. The value for a
property slot can be
string,
int,
bool,
text, or then either graph, object,
relationship, role or port GOPPRR element, or then
seq, which contains a series of string
or GOPPRR elements.