XSchema Spec - Attribute Declarations (Section 2.4), Draft 4

Ron Bourret rbourret at dvs1.informatik.tu-darmstadt.de
Mon Jul 13 13:25:11 BST 1998


> 2.4.3 Attribute Defaults
> 
> XSchema requires attribute declarations to provide information about the 
> default value of a given attribute. XSchema provides for the four cases 
> supported by XML 1.0: #REQUIRED, #IMPLIED, #FIXED AttValue, and AttValue, 
> though they are expressed as choices between required and not required and 
> fixed or not fixed, with an optional default value. There may be only one 
> default value declaration per attribute.

I used to think that Required, Fixed, and default value were orthogonal, that 
the XML naming scheme was confusing, and that this new scheme was wonderful.  
Then I looked at the possible combinations, half of which are illegal:

Required   Fixed   AttValue      XML 1.0 Value
--------   -----   --------      --------------------------------
Yes        Yes     <value>       #FIXED <value>
Yes        Yes       --             error [1]
Yes        No      <value>       AttValue
Yes        No        --          #REQUIRED
No         Yes     <value>          error [2]
No         Yes       --             error [1]
No         No      <value>          error [2]
No         No        --          #IMPLIED

[1] Fixed=Yes without a value is clearly an error.

[2] In XML, a default attribute value effectively implies that an attribute is 
required; that is, that it always has a value.  Non-required defaults don't make 
sense, as they imply that an attribute can be missing (null in database terms) 
but, if present, use a default.  XML has no concept of null-valued attributes, 
so non-required defaults are errors.

What I realized is that the relationship between Required, Fixed, and AttValue 
is hierarchical, not orthogonal:

Not required
Required, no default
Required with default
Required with fixed default

I like the wording of the current scheme, which is much clearer than XML's 
wording, but am leery that half the combinations are illegal.  Should we change 
this to another syntax with no illegal possibilities (nothing equally clear 
comes to mind) or simply document the illegal combinations?

-- Ron Bourret

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list