Defines an attribute type for use within the XML-Data Reduced (XDR) schema Schema element.
<AttributeType default="default-value" dt:type="primitive-type" dt:values="enumerated-values" name="idref" required="{yes | no}">
Number of occurrences | Unlimited. |
Parent elements | ElementType, Schema |
Child elements | Datatype, description |
TAG | Explanation |
---|---|
Name="idref" | ElementType and AttributeType elements must have names. |
required='yes' | This attribute must occur. If a default value is also given, the value must match the default. |
dt:values | Specifies the values for enumeration types. |
default | Specification of the default value for the attribute. This can apply to any type of attribute. The default value must be legal for that attribute instance. (For example, in enumeration the default value must appear in the values list.) |
An AttributeType declaration contained within an ElementType element defines that attribute type within the scope of the ElementType that contains it.
In XDR schema, as in XML 1.0, the order of appearance of attributes in an element is not constrained and a given attribute can appear no more than once in an element.
The following example shows an enumeration and its document type definition (DTD) equivalent.
<AttributeType name="colors" dt:type="enumeration" dt:values="red green blue"> <!ATTLIST x colors (red | green | blue)>
The following example declares an attribute type called myattr. This declaration constrains myattr attributes to contain only a name token.
<AttributeType name="myattr" dt:type="nmtoken"/>
XDR Schema Elements | XDR Schema Data Types Reference | attribute