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

Re: Validation rules for a complexType

From: Eric van der Vlist <vdv@dyomedea.com>
Date: 02 Jul 2002 18:08:14 +0200
To: John Verhaeg <jverhaeg@metamatrix.com>
Cc: XML Schema "Mailing List (E-mail)" <xmlschema-dev@w3.org>
Message-Id: <1025626095.13821.26.camel@ibook>


On Tue, 2002-07-02 at 17:54, John Verhaeg wrote:
> It appears to me from looking at the spec that whenever you derive a
> complexType from another complexType as a restriction, you have to
> re-declare any attributes or children from the supertype in the subtype if
> you want them to be available in the subtype.  Is this true? 

Yes and no: that's true for children elements but not for attributes
which you can either repeat or not.

> If so, it
> seems like when validating an instance of the subtype, I need look no
> farther than the subtype itself (i.e., I don't need to traverse the type
> hierarchy to see what's valid).

I use to say that derivation by restriction is not a feature to add
modularity to your schemas (since you need to repeat most of the
declaration) but a feature to add modularity to your applications. It
can be seen as a declaration which may be used by your applications if
they support the PSVI that if they know how to handle a complex type
they know how to handle any complex type derived by restriction from
this type. At the schema level, it's also implying that schema
processors check that these types are valid restrictions so there is
also a sanity check involved here.
> Also, what's the difference in this scenario between not re-declaring a
> child or attribute and declaring a child with maxOccurs=0 or an attribute
> with use="prohibited", respectively?

For attributes, since you can leave them alone you must redeclare them
with use="prohibited" to remove them from the derived type. For child
elements, why would you want to redeclare them with maxOccurs=0 ?


> Finally, where in the spec, if anywhere, are these questions answered?
> John P. A. Verhaeg
> JVerhaeg@MetaMatrix.Com <mailto:JVerhaeg@MetaMatrix.Com>
>  <<...OLE_Obj...>> 
> 11477 Olde Cabin Road Suite 400
> Creve Coeur, MO 63141
> (314) 739-3190 x150
See you in San Diego.
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
Received on Tuesday, 2 July 2002 12:08:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:03 UTC