Attribute declarations have the following format : Attribute « XML Schema « XML Tutorial






<attribute name="name of the attribute" 
           type="global type" 
           ref="global attribute declaration" 
           form="qualified or unqualified" 
           use="optional or prohibited or required" 
           default="default value" 
           fixed="fixed value"> 

There are two primary methods for declaring attributes: creating a local type or using a global type.

Attribute declarations are restricted to simple types. 
Complex types are used to define types that contain attributes or elements.
Simple types are used to restrict text-only content. 
Because an attribute can contain text only, you can use simple types only to define their allowable content. 
You can reuse attributes by referring to global attribute declarations.








3.84.Attribute
3.84.1.Declaring Attributes
3.84.2.Attribute declarations have the following format
3.84.3.Creating a Local/Global Type for Attribute
3.84.4.how we declare attributes
3.84.5.Value Constraints on Attributes
3.84.6.Value of an attribute is the same as the value we prescribe in the schema, whether or not the attribute is present
3.84.7.Attribute declarations may also be defined locally within the complexType element
3.84.8.Requiring an Attribute
3.84.9.Attribute Use: Default and Fixed Values
3.84.10.Prohibited attributes in the restriction
3.84.11.Predefining an Attribute's Content with a fixed value or a default value
3.84.12.Restrict the data type by restricting its attributes
3.84.13.Mark attribute as required
3.84.14.A globally defined attribute declaration