Microsoft XML 2.5 SDK


 

attribute Element

[This is preliminary documentation and subject to change.]

Refers to a declared attribute type that can appear within the scope of the named ElementType element.

Syntax

<attribute

    default="default-value"

    type="attribute-type"

    [required="{yes | no}"] >

Attributes

default

Default value for the attribute. This specified default takes precedence over any default provided on the AttributeType element it refers to.

type

Name of an AttributeType element defined in this schema (or another schema indicated by the specified namespace). The supplied value must correspond to the name attribute on the AttributeType element. Note that the type can include a namespace prefix.

required

Indicator of whether the attribute must be present on the element. Optional if the required attribute is present on the referenced AttributeType.

Element Information

Number of occurrences Number of attribute types specified in the schema.
Parent elements ElementType
Child elements (No child elements)
Requires closing tag Yes. XML Schema is an XML grammar and, like all XML grammars, all tags must have closing tags to satisfy the definition of well-formed.

Remarks

When the required attribute is set to "yes" and the default attribute specifies a default value, the supplied default value must always be the value, and documents containing other attribute values are invalid.

When the required attribute is set to "yes" and no default is specified, each element whose type is declared to have the attribute must supply its value.