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

RE: Attribute groups

From: Snow, Corey <CSNOW@ddpwa.com>
Date: Tue, 19 Mar 2002 16:17:57 -0800
Message-ID: <200203200017.g2K0Hxq26862@thumper.deltadentalwa.org>
To: "'Jeni Tennison'" <jeni@jenitennison.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

Hi Jeni- I'm looking for a clarification here...

> By default, the same goes for any element whose type is a type from
> which other types are derived. If a type can have other types derived
> from it, then elements of that type can have their content changed to
> those other types.
> 

In a perfect world, I'd like to be able to declare a super (abstract?) type,
then several concrete types, which would have different content models-
although not wildly so. 

So if I have a type called  "supertype", and two types derived from it-
"typeone" and "typetwo" (great imagination, eh?) Could I have something like
this in an instance document?

<supertype name="CoolBeans">This is a typeone element.</supertype>
<supertype flag="true" style="neato">This is a type two element.</supertype>

Obviously, I could do something like this just using optional attributes on
the "supertype" element. But I'd prefer to have the seperate content models,
meaning that an instance of typetwo couldnot have a "name" attribute, while
an instance of typeone could not have either a "flag" or "style" attribute.

From my reading and experimentation, I've come to the initial conclusion
that this is not possible with (this version of) XML Schema. So I've looked
into Schematron and I'm using it to validate such logical constraints, while
using XML Schema to validate format and syntax. This seems to work pretty
well, and since I can embed Schematron in XML Schema (I've adapted the
XSD2Schtrn.XSL file from the book you worked on for this) it just adds a
minor step to my validation process, without being any more difficult to
maintain.

However, from what I read above, it seems as though you *might* be saying
that I can do something like what I'm describing in pure XSD. I'd like to
know if I'm simply misreading your comments or not- I'll probably stick with
Schematron for this type of stuff anyway, because it seems "cleaner"
somehow, but it'd be nice to clear this up. :) 

thanks and regards,

Corey Snow

#########################################################
The information contained in this e-mail and subsequent attachments may be privileged, 
confidential and protected from disclosure.  This transmission is intended for the sole 
use of the individual and entity to whom it is addressed.  If you are not the intended 
recipient, any dissemination, distribution or copying is strictly prohibited.  If you 
think that you have received this message in error, please e-mail the sender at the above 
e-mail address.
#########################################################
Received on Tuesday, 19 March 2002 19:18:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT