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

RE: Attribute Uses

From: John Verhaeg <jverhaeg@metamatrix.com>
Date: Thu, 6 Jun 2002 11:20:14 -0500
Message-ID: <C7CDD3E67B05D411A45800E018C1614E7D5E51@mail>
To: "'Jeni Tennison'" <jeni@jenitennison.com>, xmlschema-dev@w3.org

Thanks, I can see now that I did misinterpret the "with respect to..."
clause.

As a side note, however, I've had a hard time understanding what the term
"locally valid" really means.  I'm I correct in assuming from your next to
last comment that these validation sections within the spec always refer to
instance documents?

John P. A. Verhaeg

-----Original Message-----
From: Jeni Tennison [mailto:jeni@jenitennison.com]
Sent: Thursday, June 06, 2002 11:06 AM
To: xmlschema-dev@w3.org; John Verhaeg
Subject: Re: Attribute Uses


Hi John,

> The "Attribute Use" described in section 3.2.2 of the Structures
> spec when a "ref" attribute is present seems to indicate that, if
> present, the default/fixed value must match the value specified in
> the declaration (the globally defined Attribute):
>
> "value constraint} If there is a default or a fixed [attribute]
> <http://www.w3.org/TR/xml-infoset/>, then a pair consisting of the ·actual
> value· (with respect to the {type definition} of the {attribute
> declaration}) of that [attribute] <http://www.w3.org/TR/xml-infoset/> and
> either default or fixed, as appropriate, otherwise ·absent·."

From what I can tell, what this says is that when you refer to a
global declaration for an attribute, then the value constraint
specified on that global declaration is completely ignored. All that
matters is whether the xs:attribute element has a default/fixed
attribute on it or not; if it doesn't, then there's no value
constraint. [This seems a bit strange to me, as I'd expect the
attribute declaration to be able to supply a default default/fixed
value, but I think that's what this is saying.]

When it says "with respect to the {type definition} of the {attribute
declaration}" it's talking about interpreting the value of the
fixed/default attribute based on the simple type of the attribute, as
declared in the attribute declaration. So for example if you had:

<xs:attribute name="date" type="xs:date" />

and then:

  <xs:attribute ref="date" default="  2002-06-06  " />

then the value '2002-06-06' would be interpreted as a date rather than
a string (and thus have whitespace stripped, for example).

> However, item 4 of Validation Rule: Attribute Locally Valid in
> section 3.2.4 states:
>
> "4 The item's ·actual value· must match the value of the {value
> constraint}, if it is present and fixed. "

This is talking about the fact that if an attribute use's {value
constraint} isn't absent, and is fixed (i.e. there's a fixed attribute
on the xs:attribute element in the schema), then the attribute in the
instance document must have that value.

> This seems to indicate that default values can be overridden in
> Attribute Uses. XML Spy seems to allow the value to be overridden
> regardless of whether the value constraint is fixed or default.

I think it's correct that default and fixed values can both be
overridden (in fact the ones on global attribute declarations are
ignored, so they are *always* overridden), and that, from your
description, XML Spy is performing correctly.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 6 June 2002 12:20:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:31 GMT