Re: : RE: Attribute use in XML schemas

Hi Stefan,

> I thought that a fixed value is also a default value.

No. Both fixed and default values are what's termed "value
constraints", but they are distinct types of value constraints. They
both have the semantic that if an attribute then the value (fixed or
default) gets used, but with a default value the value of the
attribute can be specified as something different in the instance
whereas with a fixed value it can't -- if the attribute is specified
then it *must* be given the fixed value.

A default value constraint therefore only comes into play when the
attribute is missing (which is why you're not allowed to give a
default for a required attribute -- it would never come into play). A
fixed value constraint, on the other hand, has an influence on what
values can be specified for an attribute, so has an effect when the
attribute is present as well as when it's absent. It's therefore
perfectly rationale to have an attribute that's both required (has to
be present in the instance) and fixed (has to have a particular
value).

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 27 August 2002 18:02:45 UTC