XML schemas allow developers to identify default and allowed values for attributes. This can be used to reduce the size of XML documents and also to fix attributes to particular values to help with the identification of the schemas and versions of schemas used to create particular documents. XML 1.0 provides four options for attribute 'defaulting'. Elements may be required to provide values for an attribute, may be given a default value to use if no value is presented, may be given no value at all to use if no value is presented, or may have the attribute value fixed to a particular choice made by the schema developer.
XML 1.0 attribute defaults and their XML Authority representations are listed in the table below.
Meaning | XML Authority Representation | XML 1.0 Attribute Declaration Syntax |
---|---|---|
Element instances are required to explicitly provide a value for this attribute each time the element is used. | The checkbox in the Required column is checked, with no default provided. | #REQUIRED |
Element instances may contain a value for this attribute, if the document author chooses to do so. |
No value in the default column, and the checkbox in the Required column is not checked. | #IMPLIED |
Element instances may contain a value for this attribute, but the quotedValue will be used as a default value if the attribute isn't explicitly declared in an instance of the element. |
The default value is given in the Default column, but the Required column is not checked. |
"quotedValue" |
The value of this attribute is assigned permanently to quotedValue and may never be changed. (Attempts by elements to change the value will produce validation errors. To get around this, the attribute can be re-declared in the internal subset to override the #FIXED value.) | The fixed value is given in the Default column, and the Required column is checked. | #FIXED "quotedValue" |
Copyright 2000 Extensibility, Inc.
Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516