W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Re: attribute constraints

From: Eddie Robertsson <eddie@allette.com.au>
Date: Mon, 10 Sep 2001 10:28:47 +1000
Message-ID: <3B9C093F.7A4C587C@allette.com.au>
To: Eric van der Vlist <vdv@dyomedea.com>
CC: David Carlisle <davidc@nag.co.uk>, xmlschema-dev@w3.org
> > Is it possible to change the following so that
> > <OMF/> and <OMF dec="2" hex="F"/>
> > do not  validate?
>
> No, it is impossible with "pure" W3C XML Schema and the best you can do
> is to define that those 2 attributes are not required (exactly like you
> would to in a DTD).
>
> This is one of the features allowed by RELAX NG (which treats attributes
> and elements in a more consistent way than XML Schema) and Schematron
> (which can test *almost* anything) that is not supported by W3C XML Schema.
>
> This is also a case where it makes sense to add Schematron rules to a
> W3C XML Schema using the xs:annotation/xs:appinfo extension mechanism
> provided by XML Schema (this is supported by a couple of tools).

There is also the third approach where you can use type substitution and
explicitly choose the correct datatype with the xsi:type attribute in the
instance document. In this case though I'm not sure it's worth the extra
trouble of creating two different types and then having to add the xsi:type
attribute...

Cheers,
/Eddie
Received on Tuesday, 9 October 2001 20:20:52 GMT

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