Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Default and Fixed Values of attributes

From: "Michael Kay" <mike@--------.--->
To: "'Hans Teijgeler'" <hans.teijgeler@--------.-->, "'XML-Schema Developers Forum'" <xmlschema-dev@--.--->
Date: 2/13/2005 5:50:00 PM
 

  _____  

From: xmlschema-dev-request@w... [mailto:xmlschema-dev-request@w...] 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.
 
Assume:
*	complexType A with attribute 'a' 

*	complexType B is typed with A and the inherited attribute 'a' is
restricted by means of a default or fixed value "value1" 

*	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 below) 
 
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 declaration}
<http://www.w3.org/TR/xmlschema-1/#attribute>  has the same {name}
<http://www.w3.org/TR/xmlschema-1/#a-name>  and {target
<http://www.w3.org/TR/xmlschema-1/#a-target_namespace> 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  <http://www.w3.org/TR/xmlschema-1/#au-value_constraint>
constraint}, if present, otherwise its {attribute
<http://www.w3.org/TR/xmlschema-1/#attribute> declaration}'s {value
<http://www.w3.org/TR/xmlschema-1/#a-value_constraint> constraint} . Then
one of the following must be true: 
2.1.3.1 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.
2.1.3.2 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. XMLSpy">XMLSpy 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 right.
 
Michael Kay
http://www.saxonica.com/ 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent