Attribute and Attribute Reference Properties in XML Schemas

Both global and local attributes have the properties described in the Table 75. References to attributes have the same properties, except where noted.

Property
Description
Type
For attributes, the type is always Attribute. For attribute references, the type is always Ref. to Attribute.
Name
The attribute name you use in an instance document. Specify the name you want the attribute to have.
Data Type
The type of the data that is the value of the attribute. Select from all simpleTypes defined in an XML Schema, and all simpleTypes that you already defined in the same schema. References to attributes do not have this property.
Default
Specifies the default value for this attribute. Specification of this property makes sense only for optional attributes. If you specified optional for the Restrictions property, you can specify a default value.
If this attribute is in an instance document, the attribute has whatever value you specify. If you do not specify this attribute, the schema processor behaves as though you had specified it with the default value. When you specify a default value for an attribute, that attribute must be optional in an instance document. An attribute can have a value for the Default property or a value for the Fixed Value property. The two properties are mutually exclusive.
Fixed Value
When you specify a value for Fixed Value, it is optional for the attribute to appear in an instance document. However, if the attribute does appear, it must have the value specified by Fixed Value. Whether or not you specify this attribute in an instance document, the schema processor behaves as though you had specified this attribute with the fixed value. An attribute can have a value for the Fixed Value property or a value for the Default property. The two properties are mutually exclusive.
Restrictions
Specify prohibited, optional, or required.
Form
An attribute's form is either qualified or unqualified. A form of qualified means that each time the attribute is referenced in a schema document, you must specify the prefix of its namespace. Every attribute has a form attribute. If it is not explicitly defined, the schema processor checks the default attribute form specified for the Schema node.
Table 75. Attribute and Attribute Reference Properties

 
Free Stylus Studio XML Training:
W3C Member