wiki:CMDI 1.2/Attributes/Mandatory attributes

This page is a subpage of CMDI 1.2

Mandatory attributes

The issue

In CMDI 1.1 attributes are always optional. This does not allow for mimicking of constraints of existing models (TEI header for example has mandatory attributes). Also it poses a needless restriction.

Proposed solutions

Add an element 'required' to the attribute definition in component specifications. If set to true, this translates to an additional attribute use="required" in the XSD.

Implementation examples

See Menzo's comment on #274 for a change proposal to the general component schema.

Component specification:

<CMD_Element name="firstName" ValueScheme="string" Documentation="This is the firstname of a person" DisplayPriority="0" CardinalityMax="1">
            <!-- provide a nickname attribute for the firstName element -->
            <AttributeList>
                <!-- example of an attribute using a simple type -->
                <Attribute>
                    <Name>nickname</Name>
                    <Type>string</Type>
                    <Required>true</Required>
                </Attribute>

XML Schema Document:

<xs:attribute name="nickname" type="xs:string" use="required"/>

Tickets

Tickets in the CMDI 1.2 milestone with the keyword mandatoryattributes:

Ticket Summary Owner Component Priority Status
#274 Minimal occurences for attributes Dieter Van Uytvanck ComponentSchema major closed

Discussion

Discuss the topic in general below this point

Last modified 10 years ago Last modified on 04/07/14 08:55:54