2.3.1.5 AttributeType

AttributeType schema element introduces the attribute that can be used to decorate elements in the valid document. The following XML schema defines the AttibuteType schema element:

 <xs:element  name='AttributeType'>
     <xs:complexType >
       <xs:choice  minOccurs='0'
                   maxOccurs='unbounded'>
         <xs:element  ref='xdr:datatype'/>
         <xs:element  ref='xdr:description'/>
         <xs:any  namespace='##other'
                  processContents='skip'/>
       </xs:choice>
       <xs:attribute  name='default'
                      type='xs:string'/>
       <xs:attribute  name='name'
                      type='xs:ID'/>
       <xs:attribute  ref='xdr:required'/>
       <xs:attributeGroup  ref='dt:typeAttributes'/>
       <xs:anyAttribute  namespace='##other'/>
     </xs:complexType>
   </xs:element>

datatype: The data type that the values of this attribute MUST have.

description: A description for the AttributeType element.

default: The value that the defined attribute is presumed to have if it is omitted (see section 2.3.2.2). This value MUST be valid for the datatype of the AttributeType.

name: The name of the attribute when used in valid documents and referred to by attribute element of XDR schema. Attribute names MUST be unique in the scope of a given XDR schema.

required: Indicates whether the defined attribute is mandatory (required="yes") or optional (required="no"). By default, any attribute is optional.

dt:typeAttributes: An alternative form to supply data type information.

The AttributeType schema element SHOULD appear as a child of the Schema element, or SHOULD appear as a child of the ElementType schema element.

In the first case (global attribute: child of Schema element) AttributeType just defines the type of attribute, not yet associated with any ElementType (see attribute schema element, section 2.3.1.7, which provides such an association). If AttributeType appears inside of ElementType (local attribute), it both defines attribute type and associates it with its parent ElementType. In ADO XML Persistence Format schema, AttributeType MUST be local to ElementType.