W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2005

RE: Default and Fixed Values of attributes

From: Hans Teijgeler <hans.teijgeler@quicknet.nl>
Date: Mon, 14 Feb 2005 12:37:51 +0100
To: "'Michael Kay'" <mike@saxonica.com>, "'XML-Schema Developers Forum'" <xmlschema-dev@w3.org>
Cc: "'Paap, Onno'" <onno.paap@ezzysurf.com>
Message-ID: <000001c51289$9e0f75c0$0300a8c0@hans>
Dear Michael,
Thanks for your blazingly fast response, written on a Sundaynight! It
gives some clues for further digging.
1)   In 2.1 it says that the stuff in 2.1.3 must be true IF B is in the
same target namespace as R. That is interesting. What if the schema that
defines R is imported in the schema that defines B?
2)   I would be obliged to receive your reaction on the other questions
in my message, viz:
*         Whether or not the definition of a default or fixed value
should have as a consequence that the use constraint should become
"optional" (for default values) or even should be removed at all (for
fixed values). 
*         Can you explain the rationale for the split between
specialization(typing)_by_extension and specialization_by_restriction?
>From a data modelling point of view that is illogical, because adding an
attribute or child element also constitutes an extra constraint, and
besides that it is highly inconvenient and causes a lot of hassle.
Kind regards,
-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
On Behalf Of Michael Kay
Sent: Sunday, February 13, 2005 6:50 PM
To: 'Hans Teijgeler'; 'XML-Schema Developers Forum'
Cc: 'Paap, Onno'
Subject: RE: Default and Fixed Values of attributes


From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
On Behalf Of Hans Teijgeler
Sent: 13 February 2005 16:38
To: XML-Schema Developers Forum
Cc: Paap, Onno
Subject: Default and Fixed Values of attributes
Ladies and gentlemen,
I am struggling with Default and Fixed Values for attributes, and I need
your advice.
1. complexType A with attribute 'a' 
2. complexType B is typed with A and the inherited attribute 'a' is
restricted by means of a default or fixed value "value1" 
3. complexType C is typed with B and the inherited attribute 'a' has the
inherited default or fixed value "value1" 
Now I want to define an other default or fixed value "value2" for
inherited attribute 'a' of complexType C because that value is, in the
real world, different for this subtype. WRONG!!! When I do that (in
XMLSpy, latest version) that "value2" is kind of "inherited backwards"
to the inherited attribute 'a' of complexType B, but not to A (see
The rules for "fixed" and "default" are slighly different. For "fixed",
Schema Part 1 secton 3.4.6,  Schema Component Constraint: Derivation
Valid (Restriction, Complex) tells you:
 2 For each attribute use (call this R) in the
<http://www.w3.org/TR/xmlschema-1/#ct-attribute_declarations> {attribute
uses} the appropriate case among the following must be true:
2.1 If there is an attribute use in the {attribute
<http://www.w3.org/TR/xmlschema-1/#ct-attribute_declarations>  uses} of
the {base type
<http://www.w3.org/TR/xmlschema-1/#ct-base_type_definition>  definition}
(call this B) whose {attribute
<http://www.w3.org/TR/xmlschema-1/#attribute>  declaration} has the same
{name} <http://www.w3.org/TR/xmlschema-1/#a-name>  and {target
namespace} <http://www.w3.org/TR/xmlschema-1/#a-target_namespace> , then
all of the following must be true: 
2.1.3 [Definition:]  Let the effective value constraint of an attribute
use be its {value constraint}
<http://www.w3.org/TR/xmlschema-1/#au-value_constraint> , if present,
otherwise its {attribute <http://www.w3.org/TR/xmlschema-1/#attribute>
declaration}'s {value constraint}
<http://www.w3.org/TR/xmlschema-1/#a-value_constraint>  . Then one of
the following must be true: B's  <http://www.w3.org/TR/xmlschema-1/#key-evc> .effective
value constraint. is  <http://www.w3.org/TR/xmlschema-1/#key-null>
.absent. or default. R's  <http://www.w3.org/TR/xmlschema-1/#key-evc> .effective
value constraint. is fixed with the same string as B's. 
In other words, if B has a fixed value then R (your C) must have the
same fixed value. That's reasonable: a restricted subtype can only
permit values that are valid for the supertype.
On the other hand, if B has a default value there is no rule that R
(your C) must have the same default value.
However, there's nothing in the spec corresponding to the "backwards
inheritance" you describe. 
XMLSpy seems to be internally confused 
I think this is the nub of your problem. XML Spy is not the most
conformant of schema processors. If you want to use trial and error to
find out what the spec means (and we all need to, occasionally) then use
Xerces and XSV: if they give the same answer, it's almost certainly
Michael Kay
Received on Monday, 14 February 2005 11:38:10 UTC

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