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

Re: Really Understood W3C Schema Complex Types?

  • From: Kohsuke KAWAGUCHI <kohsukekawaguchi@y...>
  • To: Jeff Rafter <jeffrafter@d...>, xml-dev@l...
  • Date: Tue, 04 Sep 2001 12:06:29 -0700

w3c schema complex restriction

> > 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.

When reading the primer, one understands that the complex type is
substitutable but I guess it's easy to forget it once s/he starts writing
a schema.


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

Yes, or may utilize the block attribute (or finalDefault/blockDefault
attributes)



> 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

I don't want to say that "hey, you can't do this in XML Schema". If I
sound like so, it's my bad. I'm just trying to defend my claim that
learning W3C XML Schema is not easy.

In this particular "type fragility" topic, I wanted to demonstrate that
sometimes you can't write restriction even if it's a true restriction,
and once it happens, the result is bizarre (because the type hierarchy
will break.)


But apparently there was a problem in my example. "repeating.derived"
should be derived from "repeating" by restriction (not from "annotation".)

<xs:complexType name="repeating">
  <xs:complexContent>
    <xs:extension base="annotated">
      <xs:group ref="list.class" minOccurs="0" maxOccurs="unbounded"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="repeating.derived">
  <xs:complexContent>
    <xs:restriction base="repeating">
      ....
      <xs:element ref="A"/>
      <xs:group ref="list.class" minOccurs="0" maxOccurs="unbounded"/>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>


> 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

I think it is fair to claim that "repeating.derived" is conceptually a
restriction of "repeating" because if something is valid wrt
"repeating.derived", it is always valid wrt the "repeating" type.

Or am I missing something?



> > (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?

I thought it's an incident that reveals the difficulty of correctly
enforcing the restriction-ok constraint.


regards,
----------------------
K.Kawaguchi
E-Mail: kohsukekawaguchi@y...


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.