2.3.1.7 attribute

The attribute element refers to AttributeType elements, defined in this XDR Schema in section 2.3.1.5 or imported from a foreign namespace. The attribute schema element appears in ElementType context (see section 2.3.1.4) and indicates that the attribute of the referred AttributeType can be used to decorate elements of this ElementType, which is called "parent" ElementType in the following example. The attribute schema element can override the required value and the default value of the referred AttributeType in a valid document, but cannot override the data type. The following XML schema defines the attribute schema element:

   <xs:element  name='attribute'>
     <xs:complexType >
       <xs:attribute  name='type'
                      type='xs:NMTOKEN'/>
       <xs:attribute  name='default'
                      type='xs:string'/>
       <xs:attribute  ref='xdr:required'/>
     </xs:complexType>
   </xs:element>

type: Name of the AttributeType element (see section 2.3.1.5), defined in this XDR schema or imported from the foreign namespace.

default: The default value. If this attribute is defined, the value overrides the default value that the referenced AttributeType defines. Overriding affects only the parent (see section 2.3.1.4). The default value MUST be valid for the data type as specified by the referred AttributeType.

required: Indicates whether this attribute, in the context of parent ElementType, is optional or mandatory. By default, attributes are optional.

If required is set to "yes" and the default value is provided, all elements of the parent ElementType in the valid document MUST have this attribute present with the value equal to default.