[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Really Understood W3C Schema Complex Types?

  • From: Jeff Rafter <jeffrafter@d...>
  • To: xml-dev@l...
  • Date: Sat, 01 Sep 2001 14:52:19 -0500

complex annotated schema
> 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



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.