OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Really Understood W3C Schema Complex Types?



> First question. How many of the schema authors know this side effect when
> s/he innocently writes this type hierarchy?  I personally saw these kind
> of mistakes made by relatively experienced schema authors.

Good question, probably not many-- it is outlined in the best practices doc
and the faq I believe (along with it being demonstrated in the primer)-- but
it is still not widely acknowledged.

> Second question. Say the schema author is fully aware of what s/he is
> doing, how many developers are aware of this side effect?  Since they
> are valid documents, an application has to accept them and to do a
> proper processing.

That is why it is probably good practice to utilize the final attribute on
your complexTypes.

> First, according to the spec, this is not a valid restriction. So you
> can't do this.

How is this an example of fragility? If anything it is an example that you
cannot do *everything* with XML Schemas... rightly so. Your first example
shows more fragility, with problematic extension and restriction... again it
gets my vote for the final attribute.

> Now what will you do? You basically need to break the type hierarchy and
> derive the "repeating.derived" type directly from the "repeating" type.
> If you need to break the type hierarchy, what is the whole point of
> using types?

As far as I can tell it doesn't seem that "repeating.derived" is in any
sense of the word a 'restriction' of "repeating" or "annotated". It should
be an extension in either case (though, in truth, repeating should be
restricted from repeating derived if you were following a natural heirarchy)

<xs:complexType name="repeating.derived">
  <xs:complexContent>
    <!-- If you intended this to be derived from "annotated" as you have
done,
           you should use an extension. It follows the same pattern as the
defintion
           for "repeating", with the exception of the fixed A element at the
start -->
    <xs:extension base="annotated">
      <xs:element ref="A"/>
      <xs:group ref="list.class" minOccurs="0" maxOccurs="unbounded"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

> (By the way, one of the horrible fact is that the author used a schema
> editor to produce this schema and still he couldn't detect this error.)

That is a problem-- but new versions are being created all of the time...
but this shouldn't be counted against the concept of complexTypes, right?

Kindest regards,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting