8.2.2 Property slots
Property slot tags can be in all
<graph>,
<object>,
<relationship>,
<role> and
<port> tags. Below we assume an
object type for simplicity.
A slot can specify an id and/or name attribute. The value
of the id attribute is the internal identifier of the property slot for that
object type. The value of the name attribute is the local name of the property
in that object type. When exporting, both are specified. When importing, if the
id attribute matches a property slot in the object type, the name attribute is
ignored. If the id attribute is not present or does not match, the name
attribute is used to find the correct slot in the object.
The simplest way to specify slots is to have a slot tag
for each property, in the same order as the properties are defined in the object
type. In this case the slot tag may not specify an id or name attribute. The
simplest content for a slot tag is just a
<value> tag, containing the
property value inside a tag that names its data type, e.g.
<string>property
value</string>.
If an id or
name attribute is specified for even
one slot in an object, all must specify
name and/or
id. However, you need not specify a
<slot> tag for every slot in an
object: if a slot in an object has no matching
<slot> tag, it will be created
with its default property type and value.
A slot contains an optional
<property> tag. The
<property> tag has a
type and
oid attribute like other GOPPRR tags,
and no other content. When importing, the
<property> tag is normally
omitted: MetaEdit+ can determine the correct property type from the slot
information, and creates an instance of that. If you want a property to be
shared between two objects you are importing, the first can specify a
<property> tag with a
type attribute and
id attribute (not
oid), and the second can specify a
<property> tag with just an
href attribute.
A slot contains an optional
<value> tag. If no
<value> tag is specified, the
default value for the property type will be used. The
<value> tag specifies the actual
value of this property, within a tag. For simple values, the tag name is the
name of the property data type, and the tag content is the value of the
property.
 | <string>a
string
value</string> |
 | <text>a
longer piece of text,
possibly with line
breaks</text> |
 | <int>12</int> |
 | <float>12.345</float> |
 | <bool>true</bool> |
Note
that the Number data type is split into int and float, since XML Schema does not
contain a generic number type. Also, string and text values use XML escapes
< for <, & for &, and > for > (> need not be
escaped when importing, but is escaped when exporting).
If the value of a property is an object, graph,
relationship, role or port, the value tag simply contains the appropriate
element and its sub-elements:
<value>
<object type="State [Watch]">
<slot>
<value>
<string>Running</string>
</value>
</slot>
</object>
</value>A property value can also be a collection
of strings, or of objects, graphs, relationships, roles or ports. In this case
the value tag contains a single
<seq> tag that contains a series
of <string> or
<object> etc. tags:
<value>
<seq>
<object type="State [Watch]"> ... </object>
<object type="State [Watch]"> ... </object>
<object type="State [Watch]"> ... </object>
</seq>
</value>