Share via


Declaring Attributes

 

Attributes are declared using the attribute element.

Example

The following example shows an attribute declaration for blue.

<xs:attribute name="blue" />

Referencing a Global Attribute Declaration

You can define attributes globally and use the ref attribute to reference global attributes.

Example

The following example shows a reference to the global attribute, blue.

<xs:element name="eyeColor" type="eyeColorType" />
<xs:complexType name="eyeColorType">
   <xs:attribute ref="blue" />
   <xs:attribute name="light" />
</xs:complexType>

Example

The following example shows another reference to the global attribute, blue.

<xs:element name="contactLense" type="contactLenseType" />
<xs:complexType name="ContactLenseType" />
   <xs:attribute ref="blue" />
</xs:complexType>