Re: ComplexType constraints

Hi John,

> Section 3.4.6 of ComplexTypes, under the heading "Schema Component
> Constraint: Derivation Valid (Extension)", states:
> "If the {derivation method} is extension, the appropriate case among the
> following must be true: 
> 1 If the {base type definition} is a complex type definition, then all of
> the following must be true: 
> ...
> 1.2[The base type definition's] {attribute uses} must be a subset of the
> {attribute uses} of the complex type definition itself, that is, for every
> attribute use in the {attribute uses} of the {base type definition}, there
> must be an attribute use in the {attribute uses} of the complex type
> definition itself whose {attribute declaration} has the same {name}, {target
> namespace} and {type definition} as its attribute declaration."
>
> The Schema of Schemas, however, violates this in that the
> "attribute" complexType doesn't have an "id" attribute defined, even
> though it is an extension of annotated, which is a complexType that
> defines an attribute named "id".
>
> Which is correct, the constraint or the schema (or am I missing
> something again)?

You're missing something again :) Note first that the constraint is a
"Schema Component Constraint", which means that it relates to the
logical content of the schema, as opposed to its XML representation.

Clause 1.2 here is talking about the {attribute uses} of the complex
type definition. If you scroll up a bit from Section 3.4.6, to Section
3.4.2 and look at the part where it defines how the {attribute uses}
of a complex type definition are identified when you've got an
extension of a complex type, you'll see that {attribute uses} is
created from the XML representation of a schema by creating:

  A union of sets of attribute uses as follows
  ...
  3 if the type definition ·resolved· to by the ·actual value· of
    the base [attribute] is a complex type definition, the {attribute
    uses} of that type definition...

In other words, if a schema is generated from an XML representation of
the schema, the {attribute uses} of a complex type definition
includes, by definition, the attribute uses of the base type
definition.

In fact, this means that it's impossible to create a complex type
definition schema component from an XML representation of a schema in
which clause 1.2 of "Schema Component Constraint: Derivation Valid
(Extension)" is false -- by definition, the {attribute uses} of the
base type must be a subset of the {attribute uses} of the derived
type. The reason the Schema Component Constraint is there, however, is
that sometimes schemas are generated without having an XML
representation, and those wouldn't by necessity follow the same logic
as those that do have an XML representation.

Cheers,

Jeni

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

Received on Thursday, 6 June 2002 14:04:22 UTC