AttributeType

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XML Schemas

AttributeType

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}">

Attributes

default
The default value for the attribute. The default value must be legal for that attribute instance. For example, when the attribute is an enumerated type, the default value must appear in the values list.
dt:type
The data type for this attribute type. In the implementation provided with Microsoft® Internet Explorer 5.0, an attribute can take one of the following types: entity, entities, enumeration, id, idref, idrefs, nmtoken, nmtokens, notation, or string. When the type enumeration is selected, the dt:values attribute should also be supplied, listing the allowed values. For more information about data types, see the XDR Schema Data Types Reference.
dt:values
A list of the possible values when dt:type is set to enumeration.
name
The name of the attribute type. This attribute is required. References to this attribute type within an ElementType definition are made in the schema with the attribute element. The name supplied here corresponds to the type attribute of the attribute element.
required
An indicator of whether the attribute must be present on the element.

Element Information

Number of occurrences Unlimited.
Parent elements ElementType, Schema
Child elements Datatype, description

Element Properties

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.)

Remarks

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.

Example

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)>

Example

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"/>

See Also

XDR Schema Elements | XDR Schema Data Types Reference | attribute