|Home MORPH Syntax Keys|
|Sponsored by Magnetar Games||Main - Specification - Forum - Syntax|
Contact Us MORPH
To aid in validation, XML Schema xs:key elements may be declared for user attributes. Such keys are not required for the model to be complete.
The specific keys that a DSL requires depends on the DSL. Generally, anywhere that one place of the instance document references a name declared elsewhere in that same instance document, a key should be used. In particular, the "Ref" attribute of all UserAttribute elements should be keyed to the Prototype or ObjectClasses object name. Also the "Prototype" attribute of the Instance element should be keyed to the Prototype declaration.
The basic syntax for creating a key is shown below. Please see XML Schema resources for more details on the syntax.
To create a key, first one must mark the unique identifier which will be used for the key. This is done with the xs:key element as shown below.
This example would mark the "Name" attribute of "Class" which is under "ClassSet" under "Prototypes" as the key. The DSL must change the "Class" and "ClassSet" placeholders as necessary to reflect the correct level of nesting and the correct early-bound element names.
Once defined, the same key may be referenced multiple times. To set up a key reference, or a tie back to the key defined previously, the following syntax is used.
Note that the "refer" attribute references the key as defined above.
Here is another example, using the same key but a different reference.
Using this same method, many keys may be built to cross-reference various parts of the DSL.