W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2002

Re: : RE: Attribute use in XML schemas

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 27 Aug 2002 23:02:44 +0100
Message-ID: <881326773118.20020827230244@jenitennison.com>
To: xmlschema-dev@w3.org, Stefan Wachter <Stefan.Wachter@gmx.de>

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



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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:05 UTC